public final class JkUtilsIterable
extends java.lang.Object
Iterable
.Constructor and Description |
---|
JkUtilsIterable() |
Modifier and Type | Method and Description |
---|---|
static <T> void |
addAllWithoutDuplicate(java.util.Collection<T> recipientList,
java.lang.Iterable<? extends T> items)
Adds items to the specified recipient list.
|
static <T> T[] |
arrayOf(java.lang.Iterable<T> it,
java.lang.Class<T> clazz)
Creates an array of the specified class and populate it with items of the specified
Iterable . |
static <T> T[] |
concat(T[] a,
T[] b)
Concatenates two arrays
|
static <T> java.util.List<T> |
concatLists(java.lang.Iterable<? extends T>... lists)
Returns a list that is a concatenation of the specified lists.
|
static <T> java.util.List<T> |
listOf(java.lang.Iterable<T> it)
Returns a list form the specified
Iterable . |
static <T> java.util.List<T> |
listOf(T... items) |
static <T> java.util.List<T> |
listOf1orMore(T item1,
T... others) |
static <T> java.util.List<T> |
listOf2orMore(T item1,
T item2,
T... others) |
static <T> java.util.List<T> |
listWithoutDuplicateOf(java.lang.Iterable<T> items)
Returns a duplicate free list of the given items
|
static <T,U> java.util.Map<T,U> |
mapOf(T key,
U value,
java.lang.Object... others)
Creates a map of specified key/value.
|
static <T,U> java.util.Map<T,U> |
mapOfAny(java.lang.Object... others)
Creates a map of specified key/value.
|
static java.util.Map<java.lang.String,java.lang.String> |
propertiesToMap(java.util.Properties properties)
Creates a
Map and populates it with specified properties. |
static <K,V> void |
putMultiEntry(java.util.Map<K,V> map,
java.lang.Iterable<K> keys,
V value)
Convenient method to put several entry in a map having the same value at
once.
|
static java.util.List<java.lang.String> |
readStringSafelyFrom(java.nio.file.Path path,
java.lang.String delimiter) |
static java.util.List<java.lang.String> |
readStringsFrom(java.nio.file.Path path,
java.lang.String delimiter) |
static <T> java.util.Set<T> |
setOf(java.lang.Iterable<T> items)
Creates a set of specified items.
|
static <T> java.util.Set<T> |
setOf(T... items)
Creates a set of specified items.
|
static java.lang.String |
toMultiLineString(java.lang.Iterable<?> items,
java.lang.String margin) |
static java.lang.String |
toString(java.util.Map<?,?> map)
Returns a string representation of the specified map constructed as
[key0]=[value0], [key1]=[value1], ...
|
static java.util.List<java.lang.String> |
toStrings(java.util.Map<?,?> map)
Returns a multi-line string representation of the specified map
constructed as [key0]=[value0], [key1]=[value1], ...
|
static void |
writeStringsTo(java.nio.file.Path path,
java.lang.String delimiter,
java.util.List<java.lang.String> strings) |
public static <T> java.util.List<T> listOf(java.lang.Iterable<T> it)
Iterable
.
If the specified Iterable
is yet a List
than it
is returned as is, otherwise a brand new List
is created.@SafeVarargs public static <T> java.util.List<T> listOf(T... items)
listOf(Iterable)
@SafeVarargs public static <T> java.util.List<T> listOf2orMore(T item1, T item2, T... others)
listOf(Iterable)
@SafeVarargs public static <T> java.util.List<T> listOf1orMore(T item1, T... others)
listOf(Iterable)
public static <T> java.util.List<T> listWithoutDuplicateOf(java.lang.Iterable<T> items)
public static <T> void addAllWithoutDuplicate(java.util.Collection<T> recipientList, java.lang.Iterable<? extends T> items)
public static <T> T[] arrayOf(java.lang.Iterable<T> it, java.lang.Class<T> clazz)
Iterable
.@SafeVarargs public static <T> java.util.Set<T> setOf(T... items)
public static <T> java.util.Set<T> setOf(java.lang.Iterable<T> items)
public static <T,U> java.util.Map<T,U> mapOf(T key, U value, java.lang.Object... others)
mapOf(key1, value1, key2, value2,...)
public static <T,U> java.util.Map<T,U> mapOfAny(java.lang.Object... others)
mapOf(key1, value1, key2, value2,...)
public static <K,V> void putMultiEntry(java.util.Map<K,V> map, java.lang.Iterable<K> keys, V value)
@SafeVarargs public static <T> java.util.List<T> concatLists(java.lang.Iterable<? extends T>... lists)
Iterable
.public static java.util.Map<java.lang.String,java.lang.String> propertiesToMap(java.util.Properties properties)
Map
and populates it with specified properties.public static java.lang.String toString(java.util.Map<?,?> map)
public static java.util.List<java.lang.String> toStrings(java.util.Map<?,?> map)
public static <T> T[] concat(T[] a, T[] b)
public static java.lang.String toMultiLineString(java.lang.Iterable<?> items, java.lang.String margin)
public static void writeStringsTo(java.nio.file.Path path, java.lang.String delimiter, java.util.List<java.lang.String> strings)
public static java.util.List<java.lang.String> readStringsFrom(java.nio.file.Path path, java.lang.String delimiter)
public static java.util.List<java.lang.String> readStringSafelyFrom(java.nio.file.Path path, java.lang.String delimiter)