Skip to content

Tag Archives: java-set

The List interface allows storing the ordered collection. It is a child interface of Collection. It is an ordered collection of objects in which duplicate… Read More
List interface in Java is a sub-interface of the Java collections interface. It contains the index-based methods to insert, update, delete, and search the elements.… Read More
The Java.util.Set.contains() method is used to check whether a specific element is present in the Set or not. So basically it is used to check… Read More
The Java.util.Set.clear() method is used to remove all the elements from a Set. Using the clear() method only clears all the element from the set… Read More
The java.util.Set.addAll(Collection C) method is used to append all of the elements from the mentioned collection to the existing set. The elements are added randomly… Read More
The add() method of Set in Java is used to add a specific element into a Set collection. The function adds the element only if… Read More
The java.util.Set.remove(Object O) method is used to remove a particular element from a Set. Syntax: boolean remove(Object O) Parameters: The parameter O is of the… Read More
The toArray() method of Java Set is used to form an array of the same elements as that of the Set. Basically, it copies all… Read More
The java.util.Set.iterator() method is used to return an iterator of the same elements as the set. The elements are returned in random order from what… Read More
The java.util.Set.size() method is used to get the size of the Set or the number of elements present in the Set. Syntax: int size() Parameters:… Read More
The java.util.Set.isEmpty() method is used to check if a Set is empty or not. It returns True if the Set is empty otherwise it returns… Read More
The retainAll() method of java.util.Set interface is used to retain from this set all of its elements that are contained in the specified collection. Syntax:… Read More
The hashCode() method of Set in Java is used to get the hashCode value for this instance of the Set. It returns an integer value… Read More
The removeAll() method of java.util.Set interface is used to remove from this set all of its elements that are contained in the specified collection. Syntax:… Read More
The equals() method of java.util.Set class is used to verify the equality of an Object with a Set and compare them. The method returns true… Read More