Java Collections emptySortedSet() Method with Examples Last Updated : 03 Jan, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report The emptySortedSet() method of Java Collections is used to get the set that has no elements. This method is used in set collection. A set is a data structure that stores unique elements in a sorted manner. Syntax: public static final <T> Set<T> emptySortedSet() Parameters: This will take no parameters. Return Type: It will return an empty set that is immutable. Example 1: Java program to create an empty sorted set Java import java.util.*; public class GFG { // main method public static void main(String[] args) { // create an empty sorted set Set<String> data = Collections.<String>emptySortedSet(); // display System.out.println(data); } } Output[] Example 2: In this program, we are going to create an empty sorted set and add elements to the set. This code will return an error. Java import java.util.*; public class GFG { // main method public static void main(String[] args) { // create an empty sorted set Set<String> data = Collections.<String>emptySortedSet(); // add 3 elements data.add("ojaswi"); data.add("ramya"); data.add("deepu"); // display System.out.println(data); } } Output: Exception in thread "main" java.lang.UnsupportedOperationException at java.util.Collections$UnmodifiableCollection.add(Collections.java:1057) at GFG.main(GFG.java:9) Comment More infoAdvertise with us Next Article Java Collections emptySet() Method with Examples O ojaswilavu8128 Follow Improve Article Tags : Java Java-Functions Java-Collections-Class Practice Tags : Java Similar Reads Java Collections emptySortedMap() Method with Examples The emptySortedMap() method of Java Collections is used to get a map that has no elements. A Sorted map is a data structure that can hold elements with key-value pairs in sorted order. Syntax: public static final <Key,Value> SortedMap<Key,Value> emptySortedMap() where, key is the key ele 2 min read Java Collections emptySet() Method with Examples The emptySet() method is used to get the set that has no elements. This method is used in set collection. A set is a data structure that can store unique elements.Syntax:public static final <T> Set<T> emptySet() Parameters: This method will take no parameters.Return Type: It will return 1 min read Java Collections emptyList() Method with Examples The emptyList() method of Java Collections returns the list with no elements. This method is immutable. That is, we can not do any modifications after creating this method. Syntax: public static final <T> List<T> emptyList() Parameters: It will not accept any parameters Return: This meth 1 min read Collections copy() method in Java with Examples The copy() method of java.util.Collections class is used to copy all of the elements from one list into another. After the operation, the index of each copied element in the destination list will be identical to its index in the source list. The destination list must be at least as long as the sourc 3 min read Collections checkedSortedSet() method in Java with Examples The checkedSortedSet() method of java.util.Collections class is used to return a dynamically typesafe view of the specified sorted set.The returned sorted set will be serializable if the specified sorted set is serializable.Since null is considered to be a value of any reference type, the returned s 2 min read Collections.sort() in Java with Examples java.util.Collections.sort() method is present in java.util.Collections class. It is used to sort the elements present in the specified list of Collection in ascending order. It works similar to java.util.Arrays.sort() method but it is better than as it can sort the elements of Array as well as link 5 min read Like