Package co.kuali.coeus.s3.conv
Class CollectionUtils
java.lang.Object
co.kuali.coeus.s3.conv.CollectionUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K, U> Collector<Map.Entry<K,U>,?,ConcurrentMap<K,U>>Convenience method to a return a Collector that converts an Map.Entry to a ConcurrentMap.Convenience method to a return a Collector that converts an Map.Entry to a Map.static <K, V> Map.Entry<K,V>entry(K key, V value)Creates an entry from a key and value.static <K, V> Map.Entry<K,V>unsafeCast(Map.Entry entry)This method takes a raw Map.Entry and casts it to a generic kind.static <T, U> Map<T,U>zipMap(T[] keys, U[] values)Takes an array of keys and an array of values and constructs a map.
-
Method Details
-
zipMap
Takes an array of keys and an array of values and constructs a map. Both key and value arrays must be the same length and non-null.- Type Parameters:
T- the key typeU- the value type- Parameters:
keys- the keys. Cannot be nullvalues- the values. Cannot be null- Returns:
- a map. cannot return null
- Throws:
IllegalArgumentException- if either argument is null or the arrays aren't the same length
-
entry
Creates an entry from a key and value.- Type Parameters:
K- the key typeV- the value type- Parameters:
key- the key. Can be null.value- the value. Can be null.- Returns:
- a Map.Entry
-
entriesToMap
Convenience method to a return a Collector that converts an Map.Entry to a Map.- Type Parameters:
K- the key typeU- the value type- Returns:
- A Collector from Map.Entry to Map
-
entriesToConcurrentMap
Convenience method to a return a Collector that converts an Map.Entry to a ConcurrentMap.- Type Parameters:
K- the key typeU- the value type- Returns:
- A Collector from Map.Entry to ConcurrentMap
-
unsafeCast
This method takes a raw Map.Entry and casts it to a generic kind.- Type Parameters:
K- the key typeV- the value type- Parameters:
entry- the entry to cast- Returns:
- the passed in entry casted
-