public final class ImmutableKit
extends java.lang.Object
| Constructor and Description |
|---|
ImmutableKit() |
| Modifier and Type | Method and Description |
|---|---|
static <T> com.google.common.collect.ImmutableList<T> |
addToList(java.util.Collection<? extends T> existing,
T newValue,
T... extraValues)
This constructs a new Immutable list from an existing collection and adds a new element to it.
|
static <K,V> com.google.common.collect.ImmutableMap<K,V> |
addToMap(java.util.Map<K,V> existing,
K newKey,
V newVal) |
static <T> com.google.common.collect.ImmutableSet<T> |
addToSet(java.util.Collection<? extends T> existing,
T newValue,
T... extraValues)
This constructs a new Immutable set from an existing collection and adds a new element to it.
|
static <T> com.google.common.collect.ImmutableList<T> |
concatLists(java.util.List<T> l1,
java.util.List<T> l2) |
static <T> com.google.common.collect.ImmutableList<T> |
emptyList() |
static <K,V> com.google.common.collect.ImmutableMap<K,V> |
emptyMap() |
static <T,R> com.google.common.collect.ImmutableList<R> |
map(java.util.Collection<? extends T> collection,
java.util.function.Function<? super T,? extends R> mapper)
This is more efficient than `c.stream().map().collect()` because it does not create the intermediate objects needed
for the flexible style.
|
static <T,R> com.google.common.collect.ImmutableList<R> |
mapAndDropNulls(java.util.Collection<? extends T> collection,
java.util.function.Function<? super T,? extends R> mapper)
This will map a collection of items but drop any that are null from the input.
|
static <T> com.google.common.collect.ImmutableList<T> |
nonNullCopyOf(java.util.Collection<T> collection) |
public static <T> com.google.common.collect.ImmutableList<T> emptyList()
public static <T> com.google.common.collect.ImmutableList<T> nonNullCopyOf(java.util.Collection<T> collection)
public static <K,V> com.google.common.collect.ImmutableMap<K,V> emptyMap()
public static <K,V> com.google.common.collect.ImmutableMap<K,V> addToMap(java.util.Map<K,V> existing,
K newKey,
V newVal)
public static <T> com.google.common.collect.ImmutableList<T> concatLists(java.util.List<T> l1,
java.util.List<T> l2)
public static <T,R> com.google.common.collect.ImmutableList<R> map(java.util.Collection<? extends T> collection,
java.util.function.Function<? super T,? extends R> mapper)
T - for twoR - for resultcollection - the collection to mapmapper - the mapper functionpublic static <T,R> com.google.common.collect.ImmutableList<R> mapAndDropNulls(java.util.Collection<? extends T> collection,
java.util.function.Function<? super T,? extends R> mapper)
T - for twoR - for resultcollection - the collection to mapmapper - the mapper function@SafeVarargs
public static <T> com.google.common.collect.ImmutableList<T> addToList(java.util.Collection<? extends T> existing,
T newValue,
T... extraValues)
T - for twoexisting - the existing collectionnewValue - the new value to addextraValues - more values to add@SafeVarargs
public static <T> com.google.common.collect.ImmutableSet<T> addToSet(java.util.Collection<? extends T> existing,
T newValue,
T... extraValues)
T - for twoexisting - the existing collectionnewValue - the new value to addextraValues - more values to add