Skip to content

Commit 5631a00

Browse files
Add files via upload
1 parent b259a47 commit 5631a00

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

Diff for: HashSetDemo22.java

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package TreeSet;
2+
import java.util.HashSet;
3+
4+
public class HashSetDemo22 {
5+
public static void main(String[] args) {
6+
HashSet<String> set = new HashSet<>();
7+
HashSet<String> set1 = new HashSet<>();
8+
9+
set.add("A");
10+
set.add("a");
11+
set.add("B");
12+
set.add("b");
13+
set1.add("A");
14+
set1.add("a");
15+
set1.add("B");
16+
set1.add("b");
17+
18+
boolean b = set1.equals(set);
19+
System.out.println(b);
20+
}
21+
}

Diff for: HashSetDemo23.java

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package TreeSet;
2+
3+
import java.util.HashSet;
4+
5+
public class HashSetDemo23 {
6+
public static void main(String[] args) {
7+
HashSet<String> set = new HashSet<>();
8+
9+
set.add("A");
10+
set.add("a");
11+
set.add("B");
12+
set.add("b");
13+
14+
String s = set.toString();
15+
System.out.println(s);
16+
}
17+
18+
}

Diff for: HashSetDemo24.java

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package TreeSet;
2+
3+
import java.util.HashSet;
4+
public class HashSetDemo24 {
5+
public static void main(String[] args) {
6+
HashSet<String> set = new HashSet<>();
7+
8+
set.add("A");
9+
set.add("a");
10+
set.add("B");
11+
set.add("b");
12+
13+
set.hashCode();
14+
15+
System.out.println(set.hashCode());
16+
17+
set.forEach(i -> System.out.println(i.hashCode()) );
18+
}
19+
20+
21+
}
22+

0 commit comments

Comments
 (0)