Class La<T,R>
Object
La<T,R>
- All Implemented Interfaces:
Function<T,,R> Predicate<T>
- Direct Known Subclasses:
La3
La is a utility generic-purpose class for functional expressions.
- Author:
- Igor Sereda
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classLa.ComparableComparator<B extends Comparable<B>>classLa.FilterIterator<D extends T>static classclassLa.TransformIterator<D extends T> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLa()protectedUse this constructor to have class-aware instance, which is needed only for few methods likearray(java.util.Collection<? extends T>). -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic <T,R> La<T, R> adapt(Function<T, R> f) <C extends Collection<R>>
CaddTo(Collection<? extends T> from, C to, boolean acceptFalsy) <C extends Collection<R>>
Cbooleanfinal RR[]array(Collection<? extends T> from) R[]array(Collection<? extends T> from, boolean acceptFalsy) arrayList(Collection<? extends T> from) arrayList(Collection<? extends T> from, boolean acceptFalsy) static <A,B extends Comparable<B>>
Comparator<A>comparator(La<A, B> function) comparator(Comparator<? super R> comparator) static <A,B, C> La<A, C> static <T,R> La<T, R> constant(R result) filterIterable(Iterable<D> iterable) <X extends T>
Xfind(Collection<X> collection, R sample) static <T,R> La<T, R> hashMap(Collection<C> collection) hashMap(Collection<C> collection, La<? super C, V> valueFunction) hashSet(Collection<? extends T> from) image(Collection<T> set) inCollection(Collection<T> collection) intinstanceOf(Class<? extends T> instanceClass) static <T> IntListintList(Collection<T> collection, La<? super T, Integer> la) isEqual(T value) abstract RintlastIndexOf(List<? extends T> list, R sample) linkedHashMap(Collection<C> collection, La<? super C, V> valueFunction) linkedHashSet(Collection<? extends T> from) static <T> LongListlongList(Collection<T> collection, La<? super T, Long> la) mapInto(Collection<C> fromCollection, Map<R, V> toMap, La<? super C, ? extends V> valueFunction) memoize()not()notNull()static <A,B> La<A, B> static <T> La<T,T> self()booleantransformIterable(Iterable<D> iterable) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Function
andThen, composeMethods inherited from interface Predicate
and, negate, or
-
Constructor Details
-
La
protected La() -
La
Use this constructor to have class-aware instance, which is needed only for few methods likearray(java.util.Collection<? extends T>).- Parameters:
rClass- the class of the result
-
-
Method Details
-
la
-
adapt
-
constant
-
constantFalse
-
constantTrue
-
isEqual
-
inCollection
-
instanceOf
-
cast
-
compose
-
self
-
fromMap
-
apply
-
test
- Specified by:
testin interfacePredicate<T>
-
apply
-
supply
-
filter
-
filter
-
filterIterable
-
accepts
-
hashSet
-
linkedHashSet
-
arrayList
-
arrayList
-
iterable
-
iterator
-
arrayList
-
arrayList
-
arrayList
-
longList
@NotNull public static <T> LongList longList(@Nullable Collection<T> collection, @NotNull La<? super T, Long> la) -
intList
@NotNull public static <T> IntList intList(@Nullable Collection<T> collection, @NotNull La<? super T, Integer> la) -
addTo
@NotNull public <C extends Collection<R>> C addTo(@Nullable Collection<? extends T> from, @NotNull C to, boolean acceptFalsy) -
addTo
@NotNull public <C extends Collection<R>> C addTo(@Nullable Iterator<? extends T> from, @NotNull C to, boolean acceptFalsy) -
transform
-
transformIterable
-
array
-
array
-
mapInto
-
mapInto
-
hashMap
-
hashMap
@NotNull public <V,C extends T> Map<R,V> hashMap(@Nullable Collection<C> collection, @NotNull La<? super C, V> valueFunction) -
linkedHashMap
@NotNull public <V,C extends T> Map<R,V> linkedHashMap(@Nullable Collection<C> collection, @NotNull La<? super C, V> valueFunction) -
indexOf
-
lastIndexOf
-
find
-
any
-
not
-
and
-
memoize
-
memoizeConcurrent
-
comparator
-
comparator
-
liftToList
-
notNull
-
stringValue
-
notNull
-
image
-