package javaapplication1;
import java.util.HashSet;
public class JavaApplication1 {
static HashSet<Integer> hash = new HashSet<>();
static void addValue(int n) {
hash.add(n);
}
static void addNumbers() {
hash.add(6);
hash.add(7);
hash.add(8);
}
public static void main(String[] args) {
try {
hash.add(1);
hash.add(2);
hash.add(3);
addValue(4);
addValue(5);
addNumbers();
hash.stream().forEach((s) -> {
System.out.println(s);
});
} catch (Exception e) {
System.out.print(e.toString());
}
}
}
/*
run:
1
2
3
4
5
6
7
8
*/