com.almworks.jira.structure.util
Class La<T,R>
java.lang.Object
com.almworks.jira.structure.util.La<T,R>
- All Implemented Interfaces:
- com.atlassian.jira.util.Predicate<T>, com.google.common.base.Function<T,R>
public abstract class La<T,R>
- extends Object
- implements com.google.common.base.Function<T,R>, com.atlassian.jira.util.Predicate<T>
La is a utility generic-purpose class for functional expressions.
- Author:
- Igor Sereda
|
Method Summary |
boolean |
accepts(T value)
|
static
|
adapt(com.google.common.base.Function<T,R> f)
|
|
addTo(Collection<? extends T> from,
C to,
boolean acceptFalsy)
|
La<T,Boolean> |
and(La<T,?> second)
|
|
apply(La<A,? extends T> f)
|
R |
apply(T from)
|
R[] |
array(Collection<? extends T> from)
|
R[] |
array(Collection<? extends T> from,
boolean acceptFalsy)
|
List<R> |
arrayList(Collection<? extends T> from)
|
List<R> |
arrayList(Collection<? extends T> from,
boolean acceptFalsy)
|
Comparator<T> |
comparator(Comparator<? super R> comparator)
|
static
|
comparator(La<A,B> function)
|
static
|
compose(La<B,C> g,
La<A,? extends B> f)
|
static
|
constant(R result)
|
boolean |
evaluate(T input)
|
|
filter(Collection<D> collection)
|
|
find(Collection<X> collection,
R sample)
|
static
|
fromMap(Map<? super T,? extends R> map,
Class<R> rClass)
|
Map<R,T> |
hashMap(Collection<? extends T> collection)
|
|
hashMap(Collection<? extends T> collection,
La<T,V> valueFunction)
|
Set<R> |
hashSet(Collection<? extends T> from)
|
static
|
inCollection(Collection<T> collection)
|
int |
indexOf(List<? extends T> list,
R sample)
|
static
|
instanceOf(Class<? extends T> instanceClass)
|
static
|
isEqual(T value)
|
abstract R |
la(T argument)
|
|
linkedHashMap(Collection<? extends T> collection,
La<T,V> valueFunction)
|
Map<R,T> |
mapInto(Collection<? extends T> fromCollection,
Map<R,T> toMap)
|
|
mapInto(Collection<? extends T> fromCollection,
Map<R,V> toMap,
La<T,V> valueFunction)
|
La<T,Boolean> |
not()
|
static
|
notNull()
|
static
|
self()
|
|
supply(La<? super R,A> g)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.google.common.base.Function |
equals |
La
protected La()
La
protected La(Class<R> rClass)
- Use this constructor to have class-aware instance, which is needed only for
few methods like
array(java.util.Collection extends T>).
- Parameters:
rClass - the class of the result
la
public abstract R la(T argument)
adapt
@NotNull
public static <T,R> La<T,R> adapt(com.google.common.base.Function<T,R> f)
constant
@NotNull
public static <T,R> La<T,R> constant(R result)
isEqual
@NotNull
public static <T> La<T,Boolean> isEqual(@Nullable
T value)
inCollection
@NotNull
public static <T> La<T,Boolean> inCollection(@Nullable
Collection<T> collection)
instanceOf
@NotNull
public static <T> La<T,Boolean> instanceOf(@Nullable
Class<? extends T> instanceClass)
compose
@NotNull
public static <A,B,C> La<A,C> compose(La<B,C> g,
La<A,? extends B> f)
self
@NotNull
public static <T> La<T,T> self()
fromMap
@NotNull
public static <T,R> La<T,R> fromMap(Map<? super T,? extends R> map,
Class<R> rClass)
apply
public final R apply(T from)
- Specified by:
apply in interface com.google.common.base.Function<T,R>
evaluate
public boolean evaluate(T input)
- Specified by:
evaluate in interface com.atlassian.jira.util.Predicate<T>
apply
@NotNull
public <A> La<A,R> apply(La<A,? extends T> f)
supply
@NotNull
public <A> La<T,A> supply(La<? super R,A> g)
filter
@NotNull
public <D extends T> List<D> filter(@Nullable
Collection<D> collection)
accepts
public boolean accepts(T value)
hashSet
@NotNull
public Set<R> hashSet(@Nullable
Collection<? extends T> from)
arrayList
@NotNull
public List<R> arrayList(@Nullable
Collection<? extends T> from)
arrayList
@NotNull
public List<R> arrayList(@Nullable
Collection<? extends T> from,
boolean acceptFalsy)
addTo
@NotNull
public <C extends Collection<R>> C addTo(@Nullable
Collection<? extends T> from,
@NotNull
C to,
boolean acceptFalsy)
array
@NotNull
public R[] array(@Nullable
Collection<? extends T> from)
array
@NotNull
public R[] array(@Nullable
Collection<? extends T> from,
boolean acceptFalsy)
mapInto
@NotNull
public Map<R,T> mapInto(@Nullable
Collection<? extends T> fromCollection,
@NotNull
Map<R,T> toMap)
mapInto
@NotNull
public <V> Map<R,V> mapInto(@Nullable
Collection<? extends T> fromCollection,
@NotNull
Map<R,V> toMap,
@NotNull
La<T,V> valueFunction)
hashMap
@NotNull
public Map<R,T> hashMap(@Nullable
Collection<? extends T> collection)
hashMap
@NotNull
public <V> Map<R,V> hashMap(@Nullable
Collection<? extends T> collection,
@NotNull
La<T,V> valueFunction)
linkedHashMap
@NotNull
public <V> Map<R,V> linkedHashMap(@Nullable
Collection<? extends T> collection,
@NotNull
La<T,V> valueFunction)
indexOf
public int indexOf(@Nullable
List<? extends T> list,
R sample)
find
@Nullable
public <X extends T> X find(@Nullable
Collection<X> collection,
R sample)
not
@NotNull
public La<T,Boolean> not()
and
public La<T,Boolean> and(La<T,?> second)
comparator
public Comparator<T> comparator(Comparator<? super R> comparator)
comparator
public static <A,B extends Comparable<B>> Comparator<A> comparator(La<A,B> function)
notNull
public static <T> La<T,Boolean> notNull()
Copyright © 2013 ALMWorks. All Rights Reserved.