LinkedHashSet isEmpty() method in Java Last Updated : 25 Jan, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report The Java.util.LinkedHashSet.isEmpty() method is used to check if a LinkedHashSet is empty or not. It returns True if the LinkedHashSet is empty otherwise it returns False. Syntax: Linked_Hash_Set.isEmpty() Parameters: This method does not take any parameter Return Value: The function returns True if the set is empty else returns False. Below program illustrate the Java.util.LinkedHashSet.isEmpty() method: Java // Java code to illustrate isEmpty() import java.io.*; import java.util.LinkedHashSet; public class LinkedHashSetDemo { public static void main(String args[]) { // Creating an empty LinkedHashSet LinkedHashSet<String> set = new LinkedHashSet<String>(); // Use add() method to add elements into the Set set.add("Welcome"); set.add("To"); set.add("Geeks"); set.add("4"); set.add("Geeks"); // Displaying the LinkedHashSet System.out.println("LinkedHashSet: " + set); // Check for the empty set System.out.println("Is the set empty: " + set.isEmpty()); // Clearing the set using clear() method set.clear(); // Again Checking for the empty set System.out.println("Is the set empty: " + set.isEmpty()); } } Output: LinkedHashSet: [Welcome, To, Geeks, 4] Is the set empty: false Is the set empty: true Comment More infoAdvertise with us Next Article LinkedHashSet isEmpty() method in Java G gopaldave Follow Improve Article Tags : Java Java-Functions java-LinkedHashSet Practice Tags : Java Similar Reads LinkedTransferQueue isEmpty() method in Java The isEmpty() method of java.util.concurrent.LinkedTransferQueue is an in-built function in Java which checks if this queue is empty or not. Syntax: LinkedTransferQueue.isEmpty() Return Value: The function returns a boolean value. It returns true if the LinkedTransferQueue is empty and returns false 1 min read LinkedHashSet contains() method in Java The Java.util.LinkedHashSet.contains() method is used to check whether a specific element is present in the LinkedHashSet or not. So basically it is used to check if a Set contains any particular element. Syntax: Hash_Set.contains(Object element) Parameters: The parameter element is of the type of L 2 min read LinkedHashSet size() method in Java The Java.util.LinkedHashSet.size() method is used to get the size of the LinkedHashSet or the number of elements present in the LinkedHashSet. Syntax: Linked_Hash_Set.size() Parameters: This method does not takes any parameter. Return Value: The method returns the size or the number of elements pres 1 min read LinkedHashSet remove() method in Java The Java.util.LinkedHashSet.remove(Object O) method is used to remove a particular element from a LinkedHashSet. Syntax: LinkedHashSet.remove(Object O) Parameters: The parameter O is of the type of LinkedHashSet and specifies the element to be removed from the LinkedHashSet. Return Value: This metho 1 min read LinkedHashSet contains() Method in Java with Examples In Java, LinkedHashSet class contains methods known as contains() which is used to return true if this set contains the specified element otherwise false. Syntax: public boolean contains(Object o) Parameters: Element o as a parameter whose presence in this set is to be tested. Return Type: A boolean 2 min read Like