List of usage examples for java.util TreeSet TreeSet
public TreeSet()
From source file:Main.java
public static void main(String[] args) { TreeSet<String> tSet = new TreeSet<String>(); tSet.add("1"); tSet.add("2"); tSet.add("3"); tSet.add("4"); tSet.add("5"); SortedSet sortedSet = tSet.subSet("2", "5"); System.out.println("SortedSet Contains : " + sortedSet); }
From source file:Main.java
public static void main(String[] args) { TreeSet<Integer> treeadd = new TreeSet<Integer>(); treeadd.add(12);/*from www .ja va2 s . c o m*/ treeadd.add(11); treeadd.add(16); treeadd.add(15); // getting ceiling value for 13 System.out.println("Ceiling value for 13: " + treeadd.ceiling(13)); }
From source file:Main.java
public static void main(String[] args) { TreeSet treeSet = new TreeSet(); Set set = Collections.synchronizedSet(treeSet); }
From source file:Main.java
public static void main(String[] args) { TreeSet<Integer> treeadd = new TreeSet<Integer>(); treeadd.add(12);/*from w ww .jav a 2 s . c o m*/ treeadd.add(13); treeadd.add(14); treeadd.add(15); // check existence of 15 System.out.println("Checking existence of 15 "); System.out.println("Is 15 there in the set: " + treeadd.contains(15)); }
From source file:Main.java
public static void main(String[] args) { TreeSet<Integer> tree = new TreeSet<Integer>(); tree.add(12);/* w ww. j a v a 2 s . c om*/ tree.add(13); tree.add(14); // cloning tree into clinetree TreeSet<Integer> clonetree = (TreeSet) tree.clone(); // creating iterator Iterator<Integer> iterator = clonetree.iterator(); while (iterator.hasNext()) { System.out.println(iterator.next()); } }
From source file:Main.java
public static void main(String[] args) { TreeSet<Integer> treeadd = new TreeSet<Integer>(); treeadd.add(1);/*from w ww . j a v a 2 s. c om*/ treeadd.add(13); treeadd.add(17); treeadd.add(22); Iterator<Integer> iterator = treeadd.iterator(); while (iterator.hasNext()) { System.out.println(iterator.next()); } }
From source file:Main.java
public static void main(String[] argv) throws Exception { SortedSet<String> set = new TreeSet<String>(); set.add("b"); set.add("c"); set.add("a"); System.out.println(set.last()); }
From source file:Main.java
public static void main(String[] args) { TreeSet<Integer> treeadd = new TreeSet<Integer>(); treeadd.add(12);/*from ww w . j a v a 2 s. c o m*/ treeadd.add(13); treeadd.add(14); treeadd.add(15); Iterator<Integer> iterator = treeadd.iterator(); while (iterator.hasNext()) { System.out.print(iterator.next()); } }
From source file:Main.java
public static void main(String[] argv) throws Exception { SortedSet<String> set = new TreeSet<String>(); set.add("b"); set.add("c"); set.add("a"); System.out.println(set.first()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { SortedSet<String> set = new TreeSet<String>(); set.add("b"); set.add("c"); set.add("a"); System.out.println(set.comparator()); }