public final class CollectionsUtil extends Object
Modifier and Type | Method and Description |
---|---|
static <T> Iterable<List<T>> |
allTuples(Iterable<? extends T> domain,
int length) |
static <T> Iterable<List<T>> |
allTuples(Iterable<? extends T> domain,
int minLength,
int maxLength)
Returns an iterator that iterates over all tuples of the given source domain whose length (dimension) is within
the specified range.
|
static <T> Iterable<List<T>> |
cartesianProduct(Iterable<T>... iterables)
Returns an iterator that iterates over the cartesian product of its given source domains.
|
static List<Character> |
charRange(char start,
char end) |
static List<String> |
charStringRange(char start,
char end) |
static List<Integer> |
intRange(int start,
int end) |
static List<Integer> |
intRange(int start,
int end,
int step) |
static <T> List<? extends T> |
randomAccessList(Collection<? extends T> coll) |
static <E> E |
removeReplace(List<E> list,
int index) |
public static <E> E removeReplace(List<E> list, int index)
public static <T> List<? extends T> randomAccessList(Collection<? extends T> coll)
public static <T> Iterable<List<T>> allTuples(Iterable<? extends T> domain, int minLength, int maxLength)
Note: Subsequent calls to the returned iterator's next()
method return a
reference to the same list, and only update the contents of the list. If you plan to reuse intermediate results,
you'll need to explicitly copy them.
T
- type of elementsdomain
- the iterables for the source domainsminLength
- the minimal length of the tuplemaxLength
- the maximum length of the tuple@SafeVarargs public static <T> Iterable<List<T>> cartesianProduct(Iterable<T>... iterables)
Note: Subsequent calls to the returned iterator's next()
method return a
reference to the same list, and only update the contents of the list. If you plan to reuse intermediate results,
you'll need to explicitly copy them.
T
- type of elementsiterables
- the iterables for the source domainsCopyright © 2020. All rights reserved.