public final class CollectionUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <K,V> java.util.Map<K,V> |
copyMapButFailOnNull(java.util.Map<? extends K,? extends V> entries)
Copy each map entry to a new map but check that each key and value isn't null.
|
static int |
findBestCollectionSize(java.lang.Iterable<?> iterable,
int bestBet)
Used to create a new collection with the correct size.
|
public static int findBestCollectionSize(java.lang.Iterable<?> iterable, int bestBet)
iterable
- the iterable we will try to find the size ofbestBet
- our best bet for the size if the iterable is not sizeablepublic static <K,V> java.util.Map<K,V> copyMapButFailOnNull(java.util.Map<? extends K,? extends V> entries)
NullPointerException
if it's the case.K
- type of keyV
- type of valueentries
- entries to copyjava.lang.NullPointerException
- if a key or value is null