The clear() method of HashSet removes all the elements from the HashSet. The HashSet becomes empty after the call to the clear() method. Syntax Parameters…
Posts published in “Java”
The isEmpty() method of HashSet checks if the HashSet is empty or not. If the HashSet is empty then it returns true otherwise returns false.…
The clone() method of HashSet returns a shallow copy of this HashSet instance. It overrides the clone() method of Object. Syntax Parameters It does not…
The remove(Element e) method of HashSet removes the specified element from the set. Syntax Parameters e is the element to be removed Return Value It…
The size() method of HashSet returns the number of elements available in the HashSet. Syntax Parameters It does not take any parameter Return Value It…
The contains(Element e) method of HashSet checks if the HashSet contains the specified element or not. It returns true if the HashSet contains the specified…
The add(E element) method of HashSet inserts the specified element into the set. It returns false if the set already contains the specified element otherwise…
The add(E element) of LinkedList appends the specified element at the end of the list. We can also add an element at a specific position…
The addFirst(E element) method of LinkedList appends the specified element at the beginning of this linked list. It does not return anything. Syntax Parameters e…
The addLast(E element) method of LinkedList appends the specified element at the end of this linked list. It does not return anything. Syntax Parameters e…