Class CollectionsUtil
- java.lang.Object
-
- net.automatalib.common.util.collection.CollectionsUtil
-
public final class CollectionsUtil extends Object
Various methods for operating on collections.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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)
-
-
-
Method Detail
-
randomAccessList
public static <T> List<? extends T> randomAccessList(Collection<? extends T> coll)
-
allTuples
public 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. Each intermediate combination of elements is computed lazily.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.- Type Parameters:
T
- type of elements- Parameters:
domain
- the iterables for the source domainsminLength
- the minimal length of the tuplemaxLength
- the maximum length of the tuple- Returns:
- an iterator that iterates over all tuples of the given source domain whose length (dimension) is within the specified range
-
cartesianProduct
@SafeVarargs public static <T> Iterable<List<T>> cartesianProduct(Iterable<T>... iterables)
Returns an iterator that iterates over the cartesian product of its given source domains. Each intermediate combination of elements is computed lazily.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.- Type Parameters:
T
- type of elements- Parameters:
iterables
- the iterables for the source domains- Returns:
- an iterator that iterates over the cartesian product of its given source domains
-
-