Java Code Examples for java.util.Collections.checkedSet()

The following are Jave code examples for showing how to use checkedSet() of the java.util.Collections class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: jdk8u-jdk   File: java_util_Collections_CheckedSet.java   Source Code and License Vote up 4 votes
protected Set<String> getObject() {
    Set<String> set = Collections.singleton("string");
    return Collections.checkedSet(set, String.class);
}
 
Example 2
Project: jdk8u-jdk   File: java_util_Collections_CheckedSet.java   Source Code and License Vote up 4 votes
protected Set<String> getAnotherObject() {
    Set<String> set = Collections.emptySet();
    return Collections.checkedSet(set, String.class);
}