Wednesday, April 25, 2018

HashSet Example in Java

Here is an example of Hashset data structure as a part of collection in Java that I wrote. The code is very short and easy to understand.

I am currently accepting programming work, it project, school programming projects , thesis and capstone projects, IT consulting work and web development work kindly contact me in the following email address for further details. Thank you.



My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.




Sample Program Output


Program Listing

HashSetExample.java

package hashsetexample;

import java.util.HashSet;

/**
 *
 * @author Mr. Jake R. Pomperada, MAED-IT
 * April 24, 2018  Tuesday
 */

public class HashSetExample {

       public static void main(String[] args) {
       System.out.println("Collections HashSet Example");
       System.out.println();
       System.out.println("Written By Mr. Jake R. Pomperada, MAED-IT");
       System.out.println();
       
       HashSet <Integer> sample = new HashSet<>();
      
       sample.add(10);
       sample.add(20);
       sample.add(30);
       sample.add(40);
       sample.add(50);
       sample.add(60);
       sample.add(70);
       sample.add(80);
       sample.add(90);
       sample.add(100);
       
       
       for (Integer obj:sample) {
            System.out.print(" "+ obj +"");
       }
       System.out.println("\n\n");
       System.out.println(" End of Program");
       System.out.println(); 
    }
}



No comments:

Post a Comment