ConcurrentSkipListSet descendingIterator() method in Java Last Updated : 17 Sep, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The descendingIterator() method of java.util.concurrent.ConcurrentSkipListSet is an in-built function in Java which is used to return an iterator over the elements in this set in descending order. Syntax: ConcurrentSkipListSet.descendingIterator() Return Value: The function returns an iterator over the elements in this set in descending order. Below programs illustrate the ConcurrentSkipListSet.descendingIterator() method: Program 1: Java // Java Program Demonstrate descendingIterator() // method of ConcurrentSkipListSet import java.util.Iterator; import java.util.concurrent.ConcurrentSkipListSet; class ConcurrentSkipListSetIteratorExample1 { public static void main(String[] args) { // Initializing the set ConcurrentSkipListSet<String> set = new ConcurrentSkipListSet<String>(); // Adding elements to this set set.add("Gfg"); set.add("is"); set.add("fun!!"); // Returns an iterator over the elements Iterator<String> iterator = set.descendingIterator(); // Printing the elements of the set while (iterator.hasNext()) System.out.print(iterator.next() + " "); } } Output: is fun!! Gfg Program 2: Java // Java Program Demonstrate descendingIterator() // method of ConcurrentSkipListSet import java.util.Iterator; import java.util.concurrent.ConcurrentSkipListSet; class ConcurrentSkipListSetIteratorExample1 { public static void main(String[] args) { // Initializing the set ConcurrentSkipListSet<Integer> set = new ConcurrentSkipListSet<Integer>(); // Adding elements to this set set.add(10); set.add(15); set.add(20); set.add(25); // Returns an iterator over the elements Iterator<Integer> iterator = set.descendingIterator(); // Printing the elements of the set while (iterator.hasNext()) System.out.print(iterator.next() + " "); } } Output: 25 20 15 10 Reference: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentSkipListSet.html#descendingIterator-- Comment More infoAdvertise with us Next Article ConcurrentSkipListSet iterator() method in Java R rupesh_rao Follow Improve Article Tags : Misc Java Java-Collections Java - util package Java-Functions Java-ConcurrentSkipListSet +2 More Practice Tags : JavaJava-CollectionsMisc Similar Reads ConcurrentSkipListSet descendingSet() method in Java The descendingSet() method of java.util.concurrent.ConcurrentSkipListSet is an in-built function in Java which returns a reverse order view of the elements contained in this set. The descending set is backed by this set, so changes to the set are reflected in the descending set, and vice-versa. Synt 2 min read ConcurrentSkipListSet iterator() method in Java The iterator() method of java.util.concurrent.ConcurrentSkipListSet is an in-built function in Java which is used to return an iterator over the elements in this set in ascending order. Syntax: ConcurrentSkipListSet.iterator() Return Value: The function returns an iterator over the elements in this 2 min read ConcurrentSkipListSet higher() method in Java The higher(E e) method of java.util.concurrent.ConcurrentSkipListSet is an in-built function in Java which returns the least element in this set strictly greater than the given element, or null if there is no such element. Syntax: public E higher(E e) Parameter: The function accepts a single paramet 2 min read ConcurrentSkipListSet headSet() method in Java headSet(E toElement) The java.util.concurrent.ConcurrentSkipListSet.headSet() method is an in-built function in Java which returns a view of the portion of this set whose elements are strictly less than toElement. The returned set is backed by this set, so changes in the returned set are reflected i 4 min read ConcurrentSkipListSet first() method in Java The first() method of java.util.concurrent.ConcurrentSkipListSet is an in-built function in Java which returns the first (lowest) element currently in this set. Syntax: ConcurrentSkipListSet.first() Return Value: The function returns the first (lowest) element currently in this set. Exception: The f 1 min read ConcurrentSkipListSet equals() method in Java The equals() method of java.util.concurrent.ConcurrentSkipListSet is an inbuilt function in Java which compares the specified object with this set for equality. It returns True if the specified object is also a set. The two sets will said to be equal if they satisfies all of the conditions stated be 3 min read Like