Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args){
- ChainMap<PoorlyHashedKey, String> map = new ChainMap<>();
- PoorlyHashedKey p1 = new PoorlyHashedKey("AppleKey");
- PoorlyHashedKey p2 = new PoorlyHashedKey("GrapeKey");
- PoorlyHashedKey p3 = new PoorlyHashedKey("BananaKey");
- PoorlyHashedKey p1Duplicate = new PoorlyHashedKey("AppleKey");
- PoorlyHashedKey p2Duplicate = new PoorlyHashedKey("GrapeKey");
- PoorlyHashedKey p3Duplicate = new PoorlyHashedKey("BananaKey");
- map.put(p1, "AppleValue");
- map.put(p2, "GrapeValue");
- map.put(p3, "BananaValue");
- System.out.println("Beginning test of original keys with values:");
- testKey(p1, map);
- testKey(p2, map);
- testKey(p3, map);
- System.out.println("Beginning test of duplicates of keys with values:");
- testKey(p1Duplicate, map);
- testKey(p2Duplicate, map);
- testKey(p3Duplicate, map);
- }
- public static void testKey(PoorlyHashedKey p, ChainMap<PoorlyHashedKey, String> map){
- System.out.println(p + "(hashcode: " + p.hashCode() + ") -> " + map.get(p));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement