File tree Expand file tree Collapse file tree 4 files changed +44
-1
lines changed Expand file tree Collapse file tree 4 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 4
4
import java .util .HashMap ;
5
5
import java .util .Map ;
6
6
import java .util .Set ;
7
+ import kevinGates .java .util .HashMapKevin ;
7
8
8
9
public class HashMapExample {
9
10
10
11
public static void main (String args []) {
11
12
12
- hashMapExampleOne ();
13
+ //hashMapExampleOne();
14
+ hashMapExampleTwo ();
13
15
}
14
16
15
17
public static void hashMapExampleOne () {
@@ -36,4 +38,13 @@ public static void hashMapExampleOne() {
36
38
users .clear ();
37
39
System .out .println (users .get (1 ));
38
40
}
41
+
42
+ public static void hashMapExampleTwo () {
43
+ HashMapKevin users = new HashMapKevin <Integer , String >();
44
+ //users.echo("map");
45
+ users .echo ("data" );
46
+
47
+ HashMapKevin usersOne = new HashMapKevin <Integer , String >(88 );
48
+ usersOne .echo ("usersOne=" +usersOne .currentKey );
49
+ }
39
50
}
Original file line number Diff line number Diff line change
1
+ package kevinGates .java .util ;
2
+
3
+ abstract public class AbstractMapKevin {
4
+
5
+ public void echo (String any ) {
6
+ System .out .println (any );;
7
+ }
8
+ }
Original file line number Diff line number Diff line change
1
+ package kevinGates .java .util ;
2
+
3
+
4
+ public class HashMapKevin <K ,V > extends AbstractMapKevin implements MapKevin {
5
+ public int currentKey ;
6
+ public HashMapKevin () {
7
+
8
+ }
9
+
10
+ public HashMapKevin (int key ) {
11
+ this .currentKey = key ;
12
+ }
13
+
14
+ public boolean isEmpty () {
15
+
16
+ return true ;
17
+ }
18
+ }
Original file line number Diff line number Diff line change
1
+ package kevinGates .java .util ;
2
+
3
+ public interface MapKevin {
4
+ public void echo (String any );
5
+ boolean isEmpty ();
6
+ }
You can’t perform that action at this time.
0 commit comments