public class FeatureListFactory extends Object
FeatureList
in different ways.Modifier and Type | Method and Description |
---|---|
static <T extends FeatureInput> |
empty()
Creates an empty list of features
|
static <S,T extends FeatureInput,E extends Exception> |
flatMapFromOptional(Iterable<S> iterable,
CheckedFunction<S,Optional<FeatureList<T>>,E> flatMapFunc)
Creates a new feature-list by flat-mapping an iterable to an optional feature
|
static <T extends FeatureInput> |
from(Feature<T>... feature)
Creates a list for one or more features
|
static <T extends FeatureInput> |
fromIterable(Iterable<Feature<T>> iterable)
Creates a list of features from an iterable
|
static <T extends FeatureInput> |
fromProvider(Provider<Feature<T>> featureProvider)
Creates a list for a single-feature created from a provider
|
static <T extends FeatureInput> |
fromProviders(Collection<FeatureProvider<T>> providers)
Creates a list of features from a collection of feature-providers
|
static <T extends FeatureInput> |
fromStream(java.util.stream.Stream<Feature<T>> stream)
Creates a list of features from a stream
|
static <S,T extends FeatureInput,E extends Exception> |
mapFrom(Iterable<S> iterable,
CheckedFunction<S,Feature<T>,E> mapFunc)
|
static <S,T extends FeatureInput,E extends Exception> |
mapFromFiltered(Iterable<S> iterable,
java.util.function.Predicate<S> predicate,
CheckedFunction<S,Feature<T>,E> mapFunc)
Creates a new feature-list by filtering an iterable and then mapping it to a feature
|
static <T extends FeatureInput> |
mapFromRange(int startInclusive,
int endExclusive,
java.util.function.IntFunction<Feature<T>> mapFunc)
Creates a new feature-list by mapping integers (from a range) each to a feature
|
static <T extends FeatureInput,E extends Exception> |
mapFromRangeOptional(int startInclusive,
int endExclusive,
Class<? extends Exception> throwableClass,
CheckedIntFunction<Optional<Feature<T>>,E> mapFunc)
Creates a new feature-list by mapping integers (from a range) each to an optional feature
|
static <T extends FeatureInput> |
wrapDuplicate(List<Feature<T>> list)
Wraps an existing list, WITHOUT reusing the list in the internals of the
FeatureList
i.e. |
static <T extends FeatureInput> |
wrapReuse(List<Feature<T>> list)
Wraps an existing list, reusing the list in the internals of the
FeatureList |
public static <T extends FeatureInput> FeatureList<T> empty()
T
- input-type of feature(s) in list@SafeVarargs public static <T extends FeatureInput> FeatureList<T> from(Feature<T>... feature)
T
- input-type of feature(s) in listfeature
- the feature(s)public static <T extends FeatureInput> FeatureList<T> fromProvider(Provider<Feature<T>> featureProvider) throws ProvisionFailedException
T
- input-type of feature(s) in listfeatureProvider
- provides the single featureProvisionFailedException
public static <T extends FeatureInput> FeatureList<T> fromIterable(Iterable<Feature<T>> iterable)
T
- input-type of feature(s) in listiterable
- the iterablepublic static <T extends FeatureInput> FeatureList<T> fromStream(java.util.stream.Stream<Feature<T>> stream)
T
- input-type of feature(s) in liststream
- the streampublic static <T extends FeatureInput> FeatureList<T> fromProviders(Collection<FeatureProvider<T>> providers) throws ProvisionFailedException
T
- input-type of feature(s) in listproviders
- the providers, each of which provides a single featureProvisionFailedException
- if an exception is occurring creating from the providerpublic static <T extends FeatureInput> FeatureList<T> wrapReuse(List<Feature<T>> list)
FeatureList
T
- input-type of feature(s) in listlist
- the list to wrappublic static <T extends FeatureInput> FeatureList<T> wrapDuplicate(List<Feature<T>> list)
FeatureList
i.e. create a new list internallyT
- input-type of feature(s) in listlist
- the list to wraplist
argument
but not the same list data structure.public static <S,T extends FeatureInput,E extends Exception> FeatureList<T> mapFrom(Iterable<S> iterable, CheckedFunction<S,Feature<T>,E> mapFunc) throws E extends Exception
S
- type that will be mapped to Feature
T
- feature input-type for the result of the mappingE
- exception-type that can be thrown during mappingiterable
- source of entities to be mappedmapFunc
- function for mappingIterable
E
- exception if it occurs during mappingE extends Exception
public static <S,T extends FeatureInput,E extends Exception> FeatureList<T> mapFromFiltered(Iterable<S> iterable, java.util.function.Predicate<S> predicate, CheckedFunction<S,Feature<T>,E> mapFunc) throws E extends Exception
S
- type that will be filtered and then mapped to a featureT
- feature input-type for the result of the mappingE
- exception-type that can be thrown during mappingiterable
- source of entities to be mappedpredicate
- only items in iterable
that fulfill this condition will be mappedmapFunc
- function for mappingiterable
E
- exception if it occurs during mappingE extends Exception
public static <S,T extends FeatureInput,E extends Exception> FeatureList<T> flatMapFromOptional(Iterable<S> iterable, CheckedFunction<S,Optional<FeatureList<T>>,E> flatMapFunc) throws E extends Exception
Any Optional.empty()
results are not included.
S
- type that will be mapped to an optional feature.T
- feature input-type for the result of the mappingE
- exception-type that can be thrown during mappingiterable
- source of entities to be mappedflatMapFunc
- function for mappingiterable
E
- exception if it occurs during mappingE extends Exception
public static <T extends FeatureInput> FeatureList<T> mapFromRange(int startInclusive, int endExclusive, java.util.function.IntFunction<Feature<T>> mapFunc)
T
- feature input-type for the result of the mappingstartInclusive
- start index for the integer range (inclusive)endExclusive
- end index for the integer range (exclusive)mapFunc
- function for mappingpublic static <T extends FeatureInput,E extends Exception> FeatureList<T> mapFromRangeOptional(int startInclusive, int endExclusive, Class<? extends Exception> throwableClass, CheckedIntFunction<Optional<Feature<T>>,E> mapFunc) throws E extends Exception
T
- feature input-type for the result of the mappingE
- an exception that be thrown during mappingstartInclusive
- start index for the integer range (inclusive)endExclusive
- end index for the integer range (exclusive)throwableClass
- the class of E
mapFunc
- function for mappingE
- if the exception is thrown during mappingE extends Exception
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.