How to Delete all the elements from HashSet ?

content Visit Website Delete all the elements from HashSet

rencontres marc robine 2014 Below example shows how to delete all entries at one call from HashSet. By calling clear() method, we can remove all elements from HashSet at once.

site de rencontre au maroc gratuit package HashSet; import java.util.HashSet; public class HashSetClear { public static void main(String[] args) { HashSet<String> hs = new HashSet<String>(); //add elements to HashSet hs.add("Selenium"); hs.add("Java"); hs.add("QTP"); System.out.println("My HashSet content:"); System.out.println(hs); System.out.println("Clearing HashSet:"); hs.clear(); System.out.println("Content After clear:"); System.out.println(hs); } }

navigate to this site site de rencontre amoureuse ado Output:
My HashSet content:
[Java, Selenium, QTP]
Clearing HashSet:
Content After clear: