Monday, 16 January 2017

HashSet : AddMethod





import java.util.*;
public class TestOne {

    public static void main(String[] args)
    {
   
        HashSet<String> ss1 = new HashSet<>();   
       
        ss1.add("One");
        ss1.add("Two");
        ss1.add("Three");
        ss1.add("Four");
        ss1.add("Two");
        ss1.add("Three");
        ss1.add("Four");
        ss1.add("Five");
       
       
            System.out.print("Full-List (Duplicate Not Allowed in HashSet) : "+ss1);
           
    }
}

No comments:

Post a Comment