public static < K , V > HashMap < K , V > newEmptyHashMap ( Iterable < ? > iterable ) { if ( iterable instanceof Collection < ? > ) return Maps . newHashMapWithExpectedSize ( ( ( Collection < ? > ) iterable ) . size ( ) ) ; return Maps . newHashMap ( ) ; }
Returns an empty map with expected size matching the iterable size if it s of type Collection . Otherwise an empty map with the default size is returned .