Java HashSet remove() MethodThe remove() is a method of Java HashSet class which removes the specified element from this set if it is present. SyntaxFollowing is the declaration of remove() method: Parameter
ReturnsThe remove() method returns true if the set contained the specified element. ExceptionsNA Compatibility VersionJava 1.2 and above Example 1Output: HashSet: [Vijay, Ravi, Aman, Ajay] HashSet after removing elements: [Ravi, Aman, Ajay] Example 2Output: HashSet: [98, 67, 24, 45] HashSet after removing elements: [67, 45] Example 3Output: 103 Operating System Galvin Wiley 6 101 Let us C Yashwant Kanetkar BPB 8 102 Data Communications & Networking Forouzan Mc Graw Hill 4 Books after remove method: 103 Operating System Galvin Wiley 6 101 Let us C Yashwant Kanetkar BPB 8 Next TopicJava hashset spliterator method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India