public final class IteratorUtils extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
IteratorUtils.FilterFunction<T> |
static interface |
IteratorUtils.MapFunction<T,S> |
Modifier and Type | Method and Description |
---|---|
static <T> Iterable<T> |
filter(Iterable<T> baseIterable,
IteratorUtils.FilterFunction<T> filter)
Given an Iterable, return a new Iterable that filters baseed off of some function.
|
static <T,S> Iterable<S> |
filterClass(Iterable<T> baseIterable,
Class<S> targetClass)
Given an Iterable, return a new Iterable that only returns values that are an instance of the provided class.
|
static <T> Iterable<T> |
join(Iterable<? extends T>... collections)
Get an iterator that iterates over all the given iterables in whatever iteration order each provides.
|
static <T,S> Iterable<S> |
map(Iterable<T> baseIterable,
IteratorUtils.MapFunction<T,S> mapFunction)
Given an Iterable, return a new Iterable that invokes the function once on each item.
|
static <T> Iterable<T> |
newIterable(Iterator<T> items)
Make an Iterable from and Interator.
|
static Iterator<int[]> |
permutations(int size)
Get an iterator that gives all the permutations of the numbers 0 - size.
|
static Iterable<boolean[]> |
powerset(int size)
Get an iterator that will go through the powerset of the specified size.
|
public static <T,S> Iterable<S> filterClass(Iterable<T> baseIterable, Class<S> targetClass)
public static <T,S> Iterable<S> map(Iterable<T> baseIterable, IteratorUtils.MapFunction<T,S> mapFunction)
public static <T> Iterable<T> filter(Iterable<T> baseIterable, IteratorUtils.FilterFunction<T> filter)
public static <T> Iterable<T> newIterable(Iterator<T> items)
@SafeVarargs public static <T> Iterable<T> join(Iterable<? extends T>... collections)
public static Iterator<int[]> permutations(int size)
public static Iterable<boolean[]> powerset(int size)
Copyright © 2020 University of California, Santa Cruz. All rights reserved.