Methods in HashSet

There are different methods defined in HashSet to perform various operations 1) boolean add(Object obj) 2) void clear() 3) Object clone() 4) boolean contains(Object obj) 5) boolean isEmpty() 6) boolean remove(Object obj) Let’s discuss each of these methods in detail boolean add(Object obj) It adds the element obj to the Set. Example :  HashSet<String> hs […]

Share this article on