Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 603c944

Browse files
Challenge 61.
HashMap hashcode method implementation.
1 parent bfc5e75 commit 603c944

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package challenge61_70;
2+
3+
import java.util.HashMap;
4+
import java.util.Map;
5+
6+
/**
7+
* HashMap's hashcode implementation
8+
* HashMap's put operation.
9+
*/
10+
public class Challenge_61 {
11+
public static void main( String[] args ) {
12+
Map<Map<Object, String>, String> mainMap = new HashMap<>();
13+
14+
Map<Object, String> subMap1 = new HashMap<>();
15+
subMap1.put(1, "A");
16+
17+
Map<Object, String> subMap2 = new HashMap<>();
18+
subMap2.put(1, "A");
19+
20+
Map<Object, String> subMap3 = new HashMap<>();
21+
subMap3.put(65, "01円");
22+
23+
System.out.println("subMap1.hashCode() = " + subMap1.hashCode());
24+
System.out.println("subMap3.hashCode() = " + subMap3.hashCode());
25+
mainMap.put(subMap1, "crazyMap1");
26+
mainMap.put(subMap2, "crazyMap2");
27+
mainMap.put(subMap3, "crazyMap3");
28+
29+
System.out.println(mainMap.size());
30+
System.out.println("mainMap.entrySet().size() = " + mainMap.entrySet().size());
31+
32+
}
33+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /