public final class WSCollections extends Object
| Constructor and Description |
|---|
WSCollections() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Map<T,T> |
asMap(T... pairs)
Map equivalent of Arrays.asList.
|
static <T> Collection<T> |
delimitedCollection(Collection<T> c,
String delimiter) |
static <K,V> Map<K,V> |
delimitedMap(Map<K,V> m,
CharSequence postKeyDelim,
CharSequence postValueDelim) |
static <K,V> Map<K,V> |
delimitedMap(Map<K,V> m,
CharSequence preKey,
CharSequence postKey,
CharSequence postValue) |
static <K,V> Map<K,V> |
delimitedMap(Map<K,V> m,
CharSequence preKey,
CharSequence postKey,
CharSequence postValue,
boolean trim) |
static <T> Collection<T> |
delimitNewLine(Collection<T> c)
Delimits with the system line separator.
|
static <K,V> Map<K,V> |
exceptionOnDuplicateMap(Map<K,V> m) |
static <T> Set<T> |
exceptionOnDuplicateSet(Set<T> s) |
static <K,V> SortedMap<K,V> |
exceptionOnDuplicateSortedMap(SortedMap<K,V> m) |
static <C extends Map<K,V>,K,V> |
putInMap(Iterable<K> things,
C destinationMap,
java.util.function.Function<? super K,V> valueFunction) |
static <C extends Map<K,V>,K,V> |
putInMap(Iterable<K> things,
C destinationMap,
V value) |
static <K,V> Map<K,V> |
putInMap(Iterable<K> things,
java.util.function.Function<? super K,V> valueFunction) |
static <K,V> Map<K,V> |
putInMap(Iterable<K> things,
V value) |
public static <K,V> SortedMap<K,V> exceptionOnDuplicateSortedMap(SortedMap<K,V> m)
public static <T> Collection<T> delimitedCollection(Collection<T> c, String delimiter)
public static <T> Collection<T> delimitNewLine(Collection<T> c)
T - the stuff in the collectionc - your collectionpublic static <K,V> Map<K,V> delimitedMap(Map<K,V> m, CharSequence postKeyDelim, CharSequence postValueDelim)
K - keyV - valuem - the map to delegate topostKeyDelim - what you want to come after every keypostValueDelim - what you want to come after every valuepublic static <K,V> Map<K,V> delimitedMap(Map<K,V> m, CharSequence preKey, CharSequence postKey, CharSequence postValue)
K - keyV - valuem - the map to delegate topreKey - what you want to come before every keypostKey - what you want to come after every keypostValue - what you want to come after every valuepublic static <K,V> Map<K,V> delimitedMap(Map<K,V> m, CharSequence preKey, CharSequence postKey, CharSequence postValue, boolean trim)
K - keyV - valuem - the map to delegate topreKey - what you want to come before every keypostKey - what you want to come after every keypostValue - what you want to come after every valuetrim - if, when output is complete, you want the last postValue to be trimmed offpublic static <T> Map<T,T> asMap(T... pairs) throws ArrayIndexOutOfBoundsException
T - the element to make pairs frompairs - Keys and values, alternatelyArrayIndexOutOfBoundsException - If an odd number of Objects are passed inpublic static <K,V> Map<K,V> putInMap(Iterable<K> things, java.util.function.Function<? super K,V> valueFunction)
public static <C extends Map<K,V>,K,V> C putInMap(Iterable<K> things, C destinationMap, java.util.function.Function<? super K,V> valueFunction)
Copyright © 2015. All rights reserved.