public class CollectionUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T> void |
addAll(java.util.Collection<T> to,
java.lang.Iterable<T> elements) |
static <T> void |
addAll(java.util.Collection<T> to,
java.util.Iterator<T> elements) |
static <T> void |
addAll(java.util.Collection<T> to,
T[] elements) |
static <T> CloseableIterator<T> |
asCloseableIterator(java.util.Iterator<T> iterator) |
static <T> java.util.List<T> |
asImmutableList(java.lang.Iterable<T> in) |
static <T> java.util.List<T> |
asImmutableList(java.util.Iterator<T> iterator) |
static <T> java.util.List<T> |
asImmutableList(T... objects)
Returns an unmodifiable
List containing the given objects,
returns an empty List, if objects is null. |
static <T> java.util.Set<T> |
asImmutableSet(java.lang.Iterable<T> in) |
static <T> java.util.Set<T> |
asImmutableSet(java.util.Iterator<T> iterator) |
static <T> java.util.Set<T> |
asImmutableSet(T... objects)
Returns an unmodifiable
Set containing the given objects,
returns an empty Set, if objects is null. |
static <T> CloseableIterator<T> |
asIterator(java.lang.Iterable<T> elements) |
static <T> CloseableIterator<T> |
asIterator(T... elements) |
static <T> java.util.List<T> |
asList(java.lang.Iterable<T> in) |
static <T> java.util.List<T> |
asList(java.util.Iterator<T> iterator) |
static <T> java.util.List<T> |
asList(T... objects)
Returns a
List containing the given objects,
returns an empty List, if objects is null. |
static <K,V> java.util.Map<K,V> |
asMap(java.lang.Object... a)
Returns a
LinkedHashMap
with the mappings a[0] => a[1], a[2] => a[3], ... |
static <T> java.util.Set<T> |
asSet(java.lang.Iterable<T> in) |
static <T> java.util.Set<T> |
asSet(java.util.Iterator<T> iterator) |
static <T> java.util.Set<T> |
asSet(T... objects)
Returns a
Set containing the given objects,
returns an empty Set, if objects is null. |
static <T> CloseableIterator<T> |
asSingletonIterator(T element) |
static <T> long |
countElementsOf(java.lang.Iterable<T> elements) |
static <T> long |
countElementsOf(java.lang.Iterable<T> elements,
com.google.common.base.Predicate<T> matches) |
static <T> long |
countElementsOf(java.util.Iterator<T> iterator) |
static <T> long |
countElementsOf(java.util.Iterator<T> iterator,
com.google.common.base.Predicate<T> matches) |
static <T> CloseableIterator<T> |
emptyIterator() |
static <T> T |
findFirstOf(java.lang.Iterable<T> elements) |
static <T> T |
findFirstOf(java.util.Iterator<T> iterator) |
static boolean |
isEmpty(java.util.Collection<?> collection) |
static boolean |
isEmpty(java.lang.Iterable<?> iterable) |
static boolean |
isEmpty(java.util.Iterator<?> iterator) |
static boolean |
isEmpty(java.util.Map<?,?> map) |
static boolean |
isEmpty(org.apache.commons.collections15.MultiMap<?,?> map) |
static boolean |
isNotEmpty(java.util.Collection<?> collection) |
static boolean |
isNotEmpty(java.lang.Iterable<?> iterable) |
static boolean |
isNotEmpty(java.util.Iterator<?> iterator) |
static boolean |
isNotEmpty(java.util.Map<?,?> map) |
static boolean |
isNotEmpty(org.apache.commons.collections15.MultiMap<?,?> map) |
static <T> boolean |
oneApplies(java.lang.Iterable<T> elements,
java.util.Collection<T> predicate) |
static <T> boolean |
oneApplies(java.lang.Iterable<T> elements,
com.google.common.base.Predicate<T> predicate) |
static <T> boolean |
oneApplies(java.lang.Iterable<T> elements,
T predicate) |
static <T> boolean |
oneApplies(java.util.Iterator<T> elements,
com.google.common.base.Predicate<T> predicate) |
static <T> boolean |
oneApplies(java.util.Iterator<T> elements,
T predicate) |
static <T> long |
removeAllOf(java.lang.Iterable<T> elements) |
static <T> long |
removeAllOf(java.lang.Iterable<T> elements,
com.google.common.base.Predicate<T> matching) |
static <T> long |
removeAllOf(java.util.Iterator<T> iterator) |
static <T> long |
removeAllOf(java.util.Iterator<T> iterator,
com.google.common.base.Predicate<T> matching) |
public static <K,V> java.util.Map<K,V> asMap(java.lang.Object... a)
LinkedHashMap
with the mappings a[0] => a[1], a[2] => a[3], ....a - the elements to construct a Map from.Map constructed of the specified elements.public static boolean isNotEmpty(@Nullable
java.util.Collection<?> collection)
public static boolean isNotEmpty(@Nullable
java.lang.Iterable<?> iterable)
public static boolean isNotEmpty(@Nullable
java.util.Iterator<?> iterator)
public static boolean isNotEmpty(@Nullable
java.util.Map<?,?> map)
public static boolean isNotEmpty(@Nullable
org.apache.commons.collections15.MultiMap<?,?> map)
public static boolean isEmpty(@Nullable
java.util.Collection<?> collection)
public static boolean isEmpty(@Nullable
java.lang.Iterable<?> iterable)
public static boolean isEmpty(@Nullable
java.util.Iterator<?> iterator)
public static boolean isEmpty(@Nullable
java.util.Map<?,?> map)
public static boolean isEmpty(@Nullable
org.apache.commons.collections15.MultiMap<?,?> map)
public static <T> void addAll(@Nonnull
java.util.Collection<T> to,
@Nullable
T[] elements)
public static <T> void addAll(@Nonnull
java.util.Collection<T> to,
@Nullable
java.lang.Iterable<T> elements)
public static <T> void addAll(@Nonnull
java.util.Collection<T> to,
@Nullable
java.util.Iterator<T> elements)
@Nonnull
public static <T> java.util.List<T> asList(@Nullable
T... objects)
List containing the given objects,
returns an empty List, if objects is null.@Nonnull
public static <T> java.util.List<T> asImmutableList(@Nullable
T... objects)
List containing the given objects,
returns an empty List, if objects is null.@Nonnull
public static <T> java.util.List<T> asList(@Nullable
java.util.Iterator<T> iterator)
@Nonnull
public static <T> java.util.List<T> asImmutableList(@Nullable
java.util.Iterator<T> iterator)
@Nonnull
public static <T> java.util.List<T> asList(@Nullable
java.lang.Iterable<T> in)
@Nonnull
public static <T> java.util.List<T> asImmutableList(@Nullable
java.lang.Iterable<T> in)
@Nonnull
public static <T> java.util.Set<T> asSet(@Nullable
T... objects)
Set containing the given objects,
returns an empty Set, if objects is null.@Nonnull
public static <T> java.util.Set<T> asImmutableSet(@Nullable
T... objects)
Set containing the given objects,
returns an empty Set, if objects is null.@Nonnull
public static <T> java.util.Set<T> asSet(@Nullable
java.util.Iterator<T> iterator)
@Nonnull
public static <T> java.util.Set<T> asImmutableSet(@Nullable
java.util.Iterator<T> iterator)
@Nonnull
public static <T> java.util.Set<T> asSet(@Nullable
java.lang.Iterable<T> in)
@Nonnull
public static <T> java.util.Set<T> asImmutableSet(@Nullable
java.lang.Iterable<T> in)
@Nonnull public static <T> CloseableIterator<T> asSingletonIterator(@Nullable T element)
@Nonnull public static <T> CloseableIterator<T> asCloseableIterator(@Nullable java.util.Iterator<T> iterator)
@SafeVarargs @Nonnull public static <T> CloseableIterator<T> asIterator(@Nullable T... elements)
@Nonnull public static <T> CloseableIterator<T> asIterator(@Nullable java.lang.Iterable<T> elements)
@Nonnull public static <T> CloseableIterator<T> emptyIterator()
public static <T> boolean oneApplies(@Nullable@WillClose
java.lang.Iterable<T> elements,
@Nullable
T predicate)
public static <T> boolean oneApplies(@Nullable@WillClose
java.lang.Iterable<T> elements,
@Nonnull
com.google.common.base.Predicate<T> predicate)
public static <T> boolean oneApplies(@Nullable@WillClose
java.lang.Iterable<T> elements,
@Nullable
java.util.Collection<T> predicate)
public static <T> boolean oneApplies(@Nullable@WillClose
java.util.Iterator<T> elements,
@Nonnull
T predicate)
public static <T> boolean oneApplies(@Nullable@WillClose
java.util.Iterator<T> elements,
@Nonnull
com.google.common.base.Predicate<T> predicate)
@Nonnegative
public static <T> long countElementsOf(@Nullable
java.lang.Iterable<T> elements)
@Nonnegative
public static <T> long countElementsOf(@Nullable
java.lang.Iterable<T> elements,
@Nullable
com.google.common.base.Predicate<T> matches)
@Nonnegative
public static <T> long countElementsOf(@Nullable
java.util.Iterator<T> iterator)
@Nonnegative
public static <T> long countElementsOf(@Nullable
java.util.Iterator<T> iterator,
@Nullable
com.google.common.base.Predicate<T> matches)
@Nullable
public static <T> T findFirstOf(@Nullable
java.lang.Iterable<T> elements)
@Nullable
public static <T> T findFirstOf(@Nullable
java.util.Iterator<T> iterator)
@Nonnegative
public static <T> long removeAllOf(@Nullable
java.lang.Iterable<T> elements)
@Nonnegative
public static <T> long removeAllOf(@Nullable
java.lang.Iterable<T> elements,
@Nullable
com.google.common.base.Predicate<T> matching)
@Nonnegative
public static <T> long removeAllOf(@Nullable
java.util.Iterator<T> iterator)
@Nonnegative
public static <T> long removeAllOf(@Nullable
java.util.Iterator<T> iterator,
@Nullable
com.google.common.base.Predicate<T> matching)
Copyright © 2013 echocat. All Rights Reserved.