Last active
November 4, 2019 07:16
-
-
Save libliboom/f3b7abb19f27371191ce46acb175c43e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public MapRecipe(Map<?, ?> map) { | |
if (map == null) throw new NullPointerException("map is null"); | |
entries = new ArrayList<Object[]>(map.size()); | |
if (RecipeHelper.hasDefaultConstructor(map.getClass())) { | |
this.typeClass = map.getClass(); | |
} else if (map instanceof SortedMap) { | |
this.typeClass = TreeMap.class; | |
} else if (map instanceof ConcurrentMap) { | |
this.typeClass = ConcurrentHashMap.class; | |
} else { | |
this.typeClass = LinkedHashMap.class; | |
} | |
putAll(map); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment