File tree 3 files changed +58
-0
lines changed
3 files changed +58
-0
lines changed Original file line number Diff line number Diff line change
1
+ import java .util .HashMap ;
2
+ public class AbstractMapMethods1 {
3
+ public static void main (String [] args ) throws Exception {
4
+ HashMap <String , Integer > map = new HashMap <>();
5
+ map .put ("a" , 1 );
6
+ map .put ("b" , 2 );
7
+ map .put ("c" , 3 );
8
+ map .put ("d" , 4 );
9
+ map .put ("e" , 5 );
10
+ map .put ("f" , 6 );
11
+ HashMap <String , Integer > map1 = new HashMap <>();
12
+ map1 .put ("a" , 1 );
13
+ map1 .put ("b" , 2 );
14
+ map1 .put ("c" , 3 );
15
+ map1 .put ("d" , 4 );
16
+ map1 .put ("e" , 5 );
17
+ map1 .put ("f" , 6 );
18
+ Boolean b = map .equals (map1 );
19
+ System .out .println ("Equals:" + b );
20
+
21
+ }
22
+
23
+ }
Original file line number Diff line number Diff line change
1
+ import java .util .HashMap ;
2
+ public class AbstractMapMethods2 {
3
+ public static void main (String [] args ) throws Exception {
4
+ HashMap <String , Integer > map = new HashMap <>();
5
+ map .put ("a" , 1 );
6
+ map .put ("b" , 2 );
7
+ map .put ("c" , 3 );
8
+ map .put ("d" , 4 );
9
+ map .put ("e" , 5 );
10
+ map .put ("f" , 6 );
11
+ System .out .println (map .toString ());
12
+ String s = map .toString ();
13
+ System .out .println (s );
14
+ System .out .println (s .getClass ());
15
+ System .out .println (s .getClass ().getName ());
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+
2
+ import java .util .HashMap ;
3
+
4
+ public class AbstractMapMethods3 {
5
+ public static void main (String [] args ) throws Exception {
6
+ HashMap <String , Integer > map = new HashMap <>();
7
+ map .put ("a" , 1 );
8
+ map .put ("b" , 2 );
9
+ map .put ("c" , 3 );
10
+ map .put ("d" , 4 );
11
+ map .put ("e" , 5 );
12
+ map .put ("f" , 6 );
13
+ System .out .println (map .hashCode ());
14
+ int i = map .hashCode ();
15
+ System .out .println (i );
16
+
17
+ }
18
+ }
You can’t perform that action at this time.
0 commit comments