Iterables { public static <K, V> HashMap<K,V> newHashMapWithSize( int expectedSize ) { return new HashMap<>( hashMapCapacity( expectedSize ) ); }  static int count( Iterable<?> it ); static List<T> asList( Iterable<T> it ); static T single( Iterable<T> it ); static Map<String, String> map( String ... alternatingKeyValue ); static Iterable<B> map(final Iterable<A> it, final Function<A,B> f); @SuppressWarnings( "unchecked" ) static Queue<T> emptyQueue(); static HashMap<K,V> newHashMapWithSize( int expectedSize ); static LinkedHashMap<K,V> newLinkedHashMapWithSize( int expectedSize );  }
@Test void shouldCreateHashMapWithExpectedSize() { assertNotNull( Iterables.newHashMapWithSize( 42 ) ); }
@Test void shouldThrowWhenNegativeHashMapSizeGiven() { assertThrows( IllegalArgumentException.class, () -> Iterables.newHashMapWithSize( -42 ) ); }