Java Code Examples for java.util.Collections#checkedSortedSet()

The following examples show how to use java.util.Collections#checkedSortedSet() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: j2objc   File: OldCollectionsTest.java    License: Apache License 2.0 5 votes vote down vote up
public void test_checkedSortedSetLjava_util_SortedSetLjava_lang_Class() {
    TreeSet ts = new TreeSet<Integer>();

    SortedSet ss = Collections.checkedSortedSet(ts, Integer.class);

    ss.add(new Integer(1));

    try {
        ss.add(new Double(3.14));
        fail("ClassCastException expected");
    } catch (ClassCastException e) {
        //expected
    }
}
 
Example 2
protected SortedSet<String> getObject() {
    SortedSet<String> set = new TreeSet<String>();
    set.add("string");
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 3
protected SortedSet<String> getAnotherObject() {
    SortedSet<String> set = new TreeSet<String>();
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 4
protected SortedSet<String> getObject() {
    SortedSet<String> set = new TreeSet<String>();
    set.add("string");
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 5
protected SortedSet<String> getAnotherObject() {
    SortedSet<String> set = new TreeSet<String>();
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 6
protected SortedSet<String> getObject() {
    SortedSet<String> set = new TreeSet<String>();
    set.add("string");
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 7
protected SortedSet<String> getAnotherObject() {
    SortedSet<String> set = new TreeSet<String>();
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 8
protected SortedSet<String> getObject() {
    SortedSet<String> set = new TreeSet<String>();
    set.add("string");
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 9
protected SortedSet<String> getAnotherObject() {
    SortedSet<String> set = new TreeSet<String>();
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 10
protected SortedSet<String> getObject() {
    SortedSet<String> set = new TreeSet<String>();
    set.add("string");
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 11
protected SortedSet<String> getAnotherObject() {
    SortedSet<String> set = new TreeSet<String>();
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 12
protected SortedSet<String> getObject() {
    SortedSet<String> set = new TreeSet<String>();
    set.add("string");
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 13
protected SortedSet<String> getAnotherObject() {
    SortedSet<String> set = new TreeSet<String>();
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 14
protected SortedSet<String> getObject() {
    SortedSet<String> set = new TreeSet<String>();
    set.add("string");
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 15
protected SortedSet<String> getAnotherObject() {
    SortedSet<String> set = new TreeSet<String>();
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 16
protected SortedSet<String> getObject() {
    SortedSet<String> set = new TreeSet<String>();
    set.add("string");
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 17
protected SortedSet<String> getObject() {
    SortedSet<String> set = new TreeSet<String>();
    set.add("string");
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 18
protected SortedSet<String> getAnotherObject() {
    SortedSet<String> set = new TreeSet<String>();
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 19
protected SortedSet<String> getObject() {
    SortedSet<String> set = new TreeSet<String>();
    set.add("string");
    return Collections.checkedSortedSet(set, String.class);
}
 
Example 20
protected SortedSet<String> getAnotherObject() {
    SortedSet<String> set = new TreeSet<String>();
    return Collections.checkedSortedSet(set, String.class);
}