Class Maps
java.lang.Object
org.glassfish.jersey.internal.guava.Maps
Static utility methods pertaining to
Map instances (including instances of
SortedMap, BiMap, etc.). Also see this class's counterparts
Lists, Sets and Queues.
See the Guava User Guide article on
Maps.
- Since:
- 2.0 (imported from Google Collections Library)
- Author:
- Kevin Bourrillion, Mike Bostock, Isaac Shum, Louis Wasserman
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> Map.Entry<K, V> immutableEntry(K key, V value) Returns an immutable map entry with the specified key and value.static <K,V> HashMap<K, V> newHashMapWithExpectedSize(int expectedSize) Creates aHashMapinstance, with a high enough "initial capacity" that it should holdexpectedSizeelements without growth.
-
Method Details
-
newHashMapWithExpectedSize
Creates aHashMapinstance, with a high enough "initial capacity" that it should holdexpectedSizeelements without growth. This behavior cannot be broadly guaranteed, but it is observed to be true for OpenJDK 1.6. It also can't be guaranteed that the method isn't inadvertently oversizing the returned map.- Parameters:
expectedSize- the number of elements you expect to add to the returned map- Returns:
- a new, empty
HashMapwith enough capacity to holdexpectedSizeelements without resizing - Throws:
IllegalArgumentException- ifexpectedSizeis negative
-
immutableEntry
Returns an immutable map entry with the specified key and value. TheMap.Entry.setValue(V)operation throws anUnsupportedOperationException.The returned entry is serializable.
- Parameters:
key- the key to be associated with the returned entryvalue- the value to be associated with the returned entry
-