| Package | Description |
|---|---|
| org.organicdesign.fp.collections |
Type-safe versions of immutable collections (mostly from Clojure), plus unmodifiable and
immutable collection interfaces that fit these collections into the java.util interfaces.
|
| org.organicdesign.fp.function |
Exception-friendly functional interfaces named by the number of arguments: Fn0, Fn1, Fn2....
|
| org.organicdesign.fp.oneOf |
This package contains Option which has Some() and None() which is useful for indicating "Not-Found"
or "End-of-stream/file".
|
| org.organicdesign.fp.xform |
Immutable descriptions of data transformations (Transformable), and a highly efficient
single-pass, short-circuiting implementation that carries out those transforms in a single pass
(Xform).
|
| Modifier and Type | Method and Description |
|---|---|
default UnmodIterable<T> |
UnmodIterable.dropWhile(Fn1<? super T,Boolean> predicate)
Ignore leading items until the given predicate returns false.
|
default UnmodIterable<T> |
UnmodIterable.filter(Fn1<? super T,Boolean> f)
Return only the items for which the given predicate returns true.
|
default <B> UnmodIterable<B> |
UnmodIterable.flatMap(Fn1<? super T,Iterable<B>> f)
Transform each item into zero or more new items using the given function.
|
<R> UnmodSortedIterator<R> |
PersistentTreeMap.iterator(Fn1<org.organicdesign.fp.collections.PersistentTreeMap.Node<K,V>,R> aFn) |
default <B> UnmodIterable<B> |
UnmodIterable.map(Fn1<? super T,? extends B> f)
Transform each item into exactly one new item using the given function.
|
default UnmodIterable<T> |
UnmodIterable.takeWhile(Fn1<? super T,Boolean> f)
Return items from the beginning until the given predicate returns false.
|
| Modifier and Type | Class and Description |
|---|---|
static class |
Fn1.ConstObjBool
Constant functions that take an Object and return a Boolean
|
static class |
Fn1.ConstObjObj
Constant functions that take an Object and return an Object
|
| Modifier and Type | Method and Description |
|---|---|
static <T> Fn1<T,Boolean> |
Fn1.accept()
Returns a type-safe version of the ConstObjBool.ACCEPT predicate.
|
static <S> Fn1<S,Boolean> |
Fn1.and(Fn1<S,Boolean> a,
Fn1<S,Boolean> b) |
static <T> Fn1<T,Boolean> |
Fn1.and(Iterable<Fn1<T,Boolean>> in)
Composes multiple predicates into a single predicate to potentially minimize trips through
the source data.
|
abstract <T> Fn1<T,Boolean> |
Fn1.BooleanCombiner.combine(Iterable<Fn1<T,Boolean>> in) |
default <S> Fn1<S,U> |
Fn1.compose(Fn1<? super S,? extends T> f) |
static <V> Fn1<V,V> |
Fn1.compose(Iterable<Fn1<V,V>> in)
Composes multiple functions into a single function to potentially minimize trips through
the source data.
|
static <V> Fn1<V,V> |
Fn1.identity() |
static <A,B> Fn1<A,B> |
Fn1.memoize(Fn1<A,B> f)
Use only on pure functions with no side effects.
|
static <S> Fn1<S,Boolean> |
Fn1.negate(Fn1<? super S,Boolean> a) |
static <S> Fn1<S,Boolean> |
Fn1.or(Fn1<S,Boolean> a,
Fn1<S,Boolean> b) |
static <T> Fn1<T,Boolean> |
Fn1.or(Iterable<Fn1<T,Boolean>> in)
Composes multiple predicates into a single predicate to potentially minimize trips through
the source data.
|
static <T> Fn1<T,Boolean> |
Fn1.reject()
Returns a type-safe version of the ConstObjBool.REJECT predicate.
|
| Modifier and Type | Method and Description |
|---|---|
static <S> Fn1<S,Boolean> |
Fn1.and(Fn1<S,Boolean> a,
Fn1<S,Boolean> b) |
static <S> Fn1<S,Boolean> |
Fn1.and(Fn1<S,Boolean> a,
Fn1<S,Boolean> b) |
default <S> Fn1<S,U> |
Fn1.compose(Fn1<? super S,? extends T> f) |
static <A,B> Fn1<A,B> |
Fn1.memoize(Fn1<A,B> f)
Use only on pure functions with no side effects.
|
static <S> Fn1<S,Boolean> |
Fn1.negate(Fn1<? super S,Boolean> a) |
static <S> Fn1<S,Boolean> |
Fn1.or(Fn1<S,Boolean> a,
Fn1<S,Boolean> b) |
static <S> Fn1<S,Boolean> |
Fn1.or(Fn1<S,Boolean> a,
Fn1<S,Boolean> b) |
| Modifier and Type | Method and Description |
|---|---|
static <T> Fn1<T,Boolean> |
Fn1.and(Iterable<Fn1<T,Boolean>> in)
Composes multiple predicates into a single predicate to potentially minimize trips through
the source data.
|
abstract <T> Fn1<T,Boolean> |
Fn1.BooleanCombiner.combine(Iterable<Fn1<T,Boolean>> in) |
static <V> Fn1<V,V> |
Fn1.compose(Iterable<Fn1<V,V>> in)
Composes multiple functions into a single function to potentially minimize trips through
the source data.
|
static <T> Fn1<T,Boolean> |
Fn1.or(Iterable<Fn1<T,Boolean>> in)
Composes multiple predicates into a single predicate to potentially minimize trips through
the source data.
|
| Modifier and Type | Method and Description |
|---|---|
<R> R |
OneOf2.match(Fn1<A,R> fa,
Fn1<B,R> fb)
Languages that have union types built in have a match statement that works like this method.
|
<R> R |
OneOf2.match(Fn1<A,R> fa,
Fn1<B,R> fb)
Languages that have union types built in have a match statement that works like this method.
|
<R> R |
OneOf2OrNone.match(Fn1<A,R> fa,
Fn1<B,R> fb,
Fn0<R> fz)
Languages that have union types built in have a match statement that works like this method.
|
<R> R |
OneOf2OrNone.match(Fn1<A,R> fa,
Fn1<B,R> fb,
Fn0<R> fz)
Languages that have union types built in have a match statement that works like this method.
|
<R> R |
OneOf3.match(Fn1<A,R> fa,
Fn1<B,R> fb,
Fn1<C,R> fc)
Languages that have union types built in have a match statement that works like this method.
|
<R> R |
OneOf3.match(Fn1<A,R> fa,
Fn1<B,R> fb,
Fn1<C,R> fc)
Languages that have union types built in have a match statement that works like this method.
|
<R> R |
OneOf3.match(Fn1<A,R> fa,
Fn1<B,R> fb,
Fn1<C,R> fc)
Languages that have union types built in have a match statement that works like this method.
|
<R> R |
OneOf4.match(Fn1<A,R> fa,
Fn1<B,R> fb,
Fn1<C,R> fc,
Fn1<D,R> fd)
Languages that have union types built in have a match statement that works like this method.
|
<R> R |
OneOf4.match(Fn1<A,R> fa,
Fn1<B,R> fb,
Fn1<C,R> fc,
Fn1<D,R> fd)
Languages that have union types built in have a match statement that works like this method.
|
<R> R |
OneOf4.match(Fn1<A,R> fa,
Fn1<B,R> fb,
Fn1<C,R> fc,
Fn1<D,R> fd)
Languages that have union types built in have a match statement that works like this method.
|
<R> R |
OneOf4.match(Fn1<A,R> fa,
Fn1<B,R> fb,
Fn1<C,R> fc,
Fn1<D,R> fd)
Languages that have union types built in have a match statement that works like this method.
|
<R> R |
Or.match(Fn1<G,R> fg,
Fn1<B,R> fb)
Exactly one of these functions will be executed - determined by whether this is a Good or a Bad.
|
<R> R |
Or.match(Fn1<G,R> fg,
Fn1<B,R> fb)
Exactly one of these functions will be executed - determined by whether this is a Good or a Bad.
|
<R> R |
Or.Good.match(Fn1<G,R> fg,
Fn1<B,R> fb)
Exactly one of these functions will be executed - determined by whether this is a Good or a Bad.
|
<R> R |
Or.Good.match(Fn1<G,R> fg,
Fn1<B,R> fb)
Exactly one of these functions will be executed - determined by whether this is a Good or a Bad.
|
<R> R |
Or.Bad.match(Fn1<G,R> fg,
Fn1<B,R> fb)
Exactly one of these functions will be executed - determined by whether this is a Good or a Bad.
|
<R> R |
Or.Bad.match(Fn1<G,R> fg,
Fn1<B,R> fb)
Exactly one of these functions will be executed - determined by whether this is a Good or a Bad.
|
<U> U |
Option.match(Fn1<T,U> has,
Fn0<U> hasNot)
Pass in a function to execute if its Some and another to execute if its None.
|
<U> U |
Option.Some.match(Fn1<T,U> has,
Fn0<U> hasNot)
Pass in a function to execute if its Some and another to execute if its None.
|
<U> U |
None.match(Fn1<T,U> has,
Fn0<U> hasNot)
Pass in a function to execute if its Some and another to execute if its None.
|
<U> Option<U> |
Option.then(Fn1<T,Option<U>> f)
If this is Some, Apply the given function, else return None.
|
<U> Option<U> |
Option.Some.then(Fn1<T,Option<U>> f)
If this is Some, Apply the given function, else return None.
|
<U> Option<U> |
None.then(Fn1<T,Option<U>> f)
If this is Some, Apply the given function, else return None.
|
| Modifier and Type | Method and Description |
|---|---|
Xform<A> |
Xform.dropWhile(Fn1<? super A,Boolean> predicate)
The number of items to drop from the beginning of the output.
|
Transformable<T> |
Transformable.dropWhile(Fn1<? super T,Boolean> predicate)
Ignore leading items until the given predicate returns false.
|
Xform<A> |
Xform.filter(Fn1<? super A,Boolean> f) |
Transformable<T> |
Transformable.filter(Fn1<? super T,Boolean> predicate)
Return only the items for which the given predicate returns true.
|
<B> Xform<B> |
Xform.flatMap(Fn1<? super A,Iterable<B>> f) |
<U> Transformable<U> |
Transformable.flatMap(Fn1<? super T,Iterable<U>> f)
Transform each item into zero or more new items using the given function.
|
<B> Xform<B> |
Xform.map(Fn1<? super A,? extends B> f) |
<U> Transformable<U> |
Transformable.map(Fn1<? super T,? extends U> func)
Transform each item into exactly one new item using the given function.
|
Xform<A> |
Xform.takeWhile(Fn1<? super A,Boolean> f) |
Transformable<T> |
Transformable.takeWhile(Fn1<? super T,Boolean> predicate)
Return items from the beginning until the given predicate returns false.
|
default <K,V> ImMap<K,V> |
Transformable.toImMap(Fn1<? super T,Map.Entry<K,V>> f1)
Realize an unordered immutable hash map to very quickly O(1) look up values by key, but don't
care about ordering.
|
default <K,V> ImSortedMap<K,V> |
Transformable.toImSortedMap(Comparator<? super K> comp,
Fn1<? super T,Map.Entry<K,V>> f1)
Realize an immutable, ordered (tree) map to quickly O(log2 n) look up values by key, but still
retrieve entries in key order.
|
default <K,V> MutableMap<K,V> |
Transformable.toMutableMap(Fn1<? super T,Map.Entry<K,V>> f1)
Realize a mutable hash map.
|
default <K,V> SortedMap<K,V> |
Transformable.toMutableSortedMap(Comparator<? super K> comp,
Fn1<? super T,Map.Entry<K,V>> f1)
Realize a mutable tree map.
|
Copyright © 2019. All rights reserved.