Class La<T,R>

Object
La<T,R>
All Implemented Interfaces:
Function<T,R>, Predicate<T>
Direct Known Subclasses:
La3

public abstract class La<T,R> extends Object implements Function<T,R>, Predicate<T>

La is a utility generic-purpose class for functional expressions.

Author:
Igor Sereda
  • Constructor Details

    • 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
  • Method Details

    • la

      public abstract R la(T argument)
    • adapt

      @NotNull public static <T, R> La<T,R> adapt(Function<T,R> f)
    • constant

      @NotNull public static <T, R> La<T,R> constant(R result)
    • constantFalse

      public static <T> La<T,Boolean> constantFalse()
    • constantTrue

      public static <T> La<T,Boolean> constantTrue()
    • 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)
    • cast

      @NotNull public static <T> La<Object,T> cast(@Nullable Class<T> clazz)
    • 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 Function<T,R>
    • test

      public boolean test(T input)
      Specified by:
      test in interface 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> ArrayList<D> filter(@Nullable Iterable<D> collection)
    • filter

      @NotNull public <D extends T> Iterator<D> filter(@Nullable Iterator<D> iterator)
    • filterIterable

      @NotNull public <D extends T> Iterable<D> filterIterable(@Nullable Iterable<D> iterable)
    • accepts

      public boolean accepts(T value)
    • hashSet

      @NotNull public HashSet<R> hashSet(@Nullable Collection<? extends T> from)
    • linkedHashSet

      @NotNull public LinkedHashSet<R> linkedHashSet(@Nullable Collection<? extends T> from)
    • arrayList

      @NotNull public List<R> arrayList(@Nullable T... from)
    • arrayList

      public List<R> arrayList(@Nullable Collection<? extends T> from)
    • iterable

      @NotNull public Iterable<R> iterable(@Nullable Iterable<? extends T> from)
    • iterator

      @NotNull public Iterator<R> iterator(Iterable<? extends T> from)
    • arrayList

      @NotNull public List<R> arrayList(@Nullable Collection<? extends T> from, boolean acceptFalsy)
    • arrayList

      public List<R> arrayList(@Nullable Iterator<? extends T> from)
    • arrayList

      public List<R> arrayList(@Nullable Iterator<? extends T> from, boolean acceptFalsy)
    • 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

      public <D extends T> Iterator<R> transform(Iterator<D> iterator)
    • transformIterable

      public <D extends T> Iterable<R> transformIterable(Iterable<D> iterable)
    • 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, C extends T> Map<R,V> mapInto(@Nullable Collection<C> fromCollection, @NotNull Map<R,V> toMap, @NotNull La<? super C,? extends V> valueFunction)
    • hashMap

      @NotNull public <C extends T> Map<R,C> hashMap(@Nullable Collection<C> collection)
    • 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

      public int indexOf(@Nullable List<? extends T> list, R sample)
    • lastIndexOf

      public int lastIndexOf(@Nullable List<? extends T> list, R sample)
    • find

      @Nullable public <X extends T> X find(@Nullable Collection<X> collection, R sample)
    • any

      public boolean any(@Nullable Iterable<? extends T> sequence)
    • not

      @NotNull public La<T,Boolean> not()
    • and

      public La<T,Boolean> and(La<? super T,?> second)
    • memoize

      public La<T,R> memoize()
    • memoizeConcurrent

      public La<T,R> memoizeConcurrent()
    • comparator

      public Comparator<T> comparator(Comparator<? super R> comparator)
    • comparator

      public static <A, B extends Comparable<B>> Comparator<A> comparator(La<A,B> function)
    • liftToList

      public <C extends Iterable<? extends T>> La<C,List<R>> liftToList()
    • notNull

      public static <T> La<T,Boolean> notNull()
    • stringValue

      public static <T> La<T,String> stringValue()
    • notNull

      public static <A, B> La<A,B> notNull(La<A,B> la, B onNull)
    • image

      public Collection<R> image(Collection<T> set)