List of usage examples for java.util Collections checkedSortedSet
public static <E> SortedSet<E> checkedSortedSet(SortedSet<E> s, Class<E> type)
From source file:Main.java
public static void main(String args[]) { SortedSet<String> sset = new TreeSet<String>(); sset.add("tutorial"); sset.add("from"); sset.add("java2s.com"); // get typesafe view of the sorted set SortedSet<String> tsset = Collections.checkedSortedSet(sset, String.class); System.out.println(tsset);/*from w w w .j a v a 2 s .c o m*/ }