File tree 3 files changed +61
-0
lines changed
3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+
You can’t perform that action at this time.
0 commit comments