| Package | Description |
|---|---|
| org.organicdesign.fp |
A data definition language, and other tools for writing functional Java.
|
| org.organicdesign.fp.collections |
Type-safe versions of the immutable Clojure collections, plus unmodifiable and immutable
collection interfaces that extend the java.util collections, deprecating the mutate-in-place
methods (Unmod____) and adding methods that return a new, immutable, modified version of the
collection (Im____).
|
| org.organicdesign.fp.either |
This approximates union of two types for Java - for when something (e.g.
|
| org.organicdesign.fp.function |
Exception-friendly functional interfaces named by the number of arguments: Function0, Function1, Function2....
|
| 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 |
|---|---|
<U> U |
Option.patMat(Function1<T,U> has,
Function0<U> hasNot)
Pass in a function to execute if its Some and another to execute if its None.
|
<U> U |
Option.None.patMat(Function1<T,U> has,
Function0<U> hasNot)
Pass in a function to execute if its Some and another to execute if its None.
|
<U> U |
Option.Some.patMat(Function1<T,U> has,
Function0<U> hasNot)
Pass in a function to execute if its Some and another to execute if its None.
|
static <B,G,R> R |
Or.patMatch(Or<G,B> either,
Function1<? super G,R> g,
Function1<? super B,R> b)
Pattern-match, applying the first function if the given either is a Bad, the second if it's a Good.
|
static <B,G,R> R |
Or.patMatch(Or<G,B> either,
Function1<? super G,R> g,
Function1<? super B,R> b)
Pattern-match, applying the first function if the given either is a Bad, the second if it's a Good.
|
<U> Option<U> |
Option.then(Function1<T,Option<U>> f)
If this is Some, Apply the given function, else return None.
|
<U> Option<U> |
Option.None.then(Function1<T,Option<U>> f)
If this is Some, Apply the given function, else return None.
|
<U> Option<U> |
Option.Some.then(Function1<T,Option<U>> f)
If this is Some, Apply the given function, else return None.
|
| Modifier and Type | Method and Description |
|---|---|
default UnmodIterable<T> |
UnmodIterable.filter(Function1<? super T,Boolean> f)
Return only the items for which the given predicate returns true.
|
default <B> UnmodIterable<B> |
UnmodIterable.flatMap(Function1<? super T,Iterable<B>> f)
Transform each item into zero or more new items using the given function.
|
default <B> B |
UnmodIterable.foldLeft(B ident,
Function2<B,? super T,B> reducer,
Function1<? super B,Boolean> terminateWhen)
Normally you want to terminate by doing a take(), drop(), or takeWhile() before you get to the
fold, but if you need to terminate based on the complete result so far, you can provide your
own termination condition to this version of foldLeft().
|
default <B> UnmodIterable<B> |
UnmodIterable.map(Function1<? super T,? extends B> f)
Transform each item into exactly one new item using the given function.
|
default UnmodIterable<T> |
UnmodIterable.takeWhile(Function1<? super T,Boolean> f)
Return items from the beginning until the given predicate returns false.
|
| Modifier and Type | Method and Description |
|---|---|
<R> R |
OneOf2.typeMatch(Function1<A,R> fa,
Function1<B,R> fb) |
<R> R |
OneOf2.typeMatch(Function1<A,R> fa,
Function1<B,R> fb) |
| Modifier and Type | Class and Description |
|---|---|
static class |
Function1.Const |
static class |
Function1.ConstBool |
| Modifier and Type | Field and Description |
|---|---|
static Function1<Object,Boolean> |
Function1.ACCEPT
Deprecated.
|
static Function1<Object,Object> |
Function1.IDENTITY
Deprecated.
|
static Function1<Object,Boolean> |
Function1.REJECT
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> Function1<T,Boolean> |
Function1.accept()
Returns a type-safe version of the ConstBool.ACCEPT predicate.
|
static <S> Function1<S,Boolean> |
Function1.and(Function1<S,Boolean> a,
Function1<S,Boolean> b) |
static <T> Function1<T,Boolean> |
Function1.and(Iterable<Function1<T,Boolean>> in)
Composes multiple predicates into a single predicate to potentially minimize trips through
the source data.
|
abstract <T> Function1<T,Boolean> |
Function1.BooleanCombiner.combine(Iterable<Function1<T,Boolean>> in) |
default <S> Function1<S,U> |
Function1.compose(Function1<? super S,? extends T> f) |
static <V> Function1<V,V> |
Function1.compose(Iterable<Function1<V,V>> in)
Composes multiple functions into a single function to potentially minimize trips through
the source data.
|
static <V> Function1<V,V> |
Function1.identity() |
static <A,B> Function1<A,B> |
Function1.memoize(Function1<A,B> f)
Use only on pure functions with no side effects.
|
static <S> Function1<S,Boolean> |
Function1.negate(Function1<? super S,Boolean> a) |
static <S> Function1<S,Boolean> |
Function1.or(Function1<S,Boolean> a,
Function1<S,Boolean> b) |
static <T> Function1<T,Boolean> |
Function1.or(Iterable<Function1<T,Boolean>> in)
Composes multiple predicates into a single predicate to potentially minimize trips through
the source data.
|
static <T> Function1<T,Boolean> |
Function1.reject()
Returns a type-safe version of the ConstBool.REJECT predicate.
|
| Modifier and Type | Method and Description |
|---|---|
static <S> Function1<S,Boolean> |
Function1.and(Function1<S,Boolean> a,
Function1<S,Boolean> b) |
static <S> Function1<S,Boolean> |
Function1.and(Function1<S,Boolean> a,
Function1<S,Boolean> b) |
default <S> Function1<S,U> |
Function1.compose(Function1<? super S,? extends T> f) |
static <A,B> Function1<A,B> |
Function1.memoize(Function1<A,B> f)
Use only on pure functions with no side effects.
|
static <S> Function1<S,Boolean> |
Function1.negate(Function1<? super S,Boolean> a) |
static <S> Function1<S,Boolean> |
Function1.or(Function1<S,Boolean> a,
Function1<S,Boolean> b) |
static <S> Function1<S,Boolean> |
Function1.or(Function1<S,Boolean> a,
Function1<S,Boolean> b) |
| Modifier and Type | Method and Description |
|---|---|
static <T> Function1<T,Boolean> |
Function1.and(Iterable<Function1<T,Boolean>> in)
Composes multiple predicates into a single predicate to potentially minimize trips through
the source data.
|
abstract <T> Function1<T,Boolean> |
Function1.BooleanCombiner.combine(Iterable<Function1<T,Boolean>> in) |
static <V> Function1<V,V> |
Function1.compose(Iterable<Function1<V,V>> in)
Composes multiple functions into a single function to potentially minimize trips through
the source data.
|
static <T> Function1<T,Boolean> |
Function1.or(Iterable<Function1<T,Boolean>> in)
Composes multiple predicates into a single predicate to potentially minimize trips through
the source data.
|
| Modifier and Type | Method and Description |
|---|---|
Xform<A> |
Xform.filter(Function1<? super A,Boolean> f) |
Transformable<T> |
Transformable.filter(Function1<? super T,Boolean> predicate)
Return only the items for which the given predicate returns true.
|
<B> Xform<B> |
Xform.flatMap(Function1<? super A,Iterable<B>> f) |
<U> Transformable<U> |
Transformable.flatMap(Function1<? super T,Iterable<U>> f)
Transform each item into zero or more new items using the given function.
|
<B> B |
Xform.foldLeft(B ident,
Function2<B,? super A,B> reducer,
Function1<? super B,Boolean> terminateWhen)
Thit implementation should be correct, but could be slow in the case where previous operations
are slow and the terminateWhen operation is fast and terminates early.
|
<U> U |
Transformable.foldLeft(U u,
Function2<U,? super T,U> fun,
Function1<? super U,Boolean> terminateWhen)
Normally you want to terminate by doing a take(), drop(), or takeWhile() before you get to the
fold, but if you need to terminate based on the complete result so far, you can provide your
own termination condition to this version of foldLeft().
|
<B> Xform<B> |
Xform.map(Function1<? super A,? extends B> f) |
<U> Transformable<U> |
Transformable.map(Function1<? super T,? extends U> func)
Transform each item into exactly one new item using the given function.
|
Xform<A> |
Xform.takeWhile(Function1<? super A,Boolean> f) |
Transformable<T> |
Transformable.takeWhile(Function1<? super T,Boolean> predicate)
Return items from the beginning until the given predicate returns false.
|
default <K,V> ImMap<K,V> |
Transformable.toImMap(Function1<? 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,
Function1<? 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> Map<K,V> |
Transformable.toMutableMap(Function1<? super T,Map.Entry<K,V>> f1)
Realize a mutable hash map.
|
default <K,V> SortedMap<K,V> |
Transformable.toMutableSortedMap(Comparator<? super K> comp,
Function1<? super T,Map.Entry<K,V>> f1)
Realize a mutable tree map.
|
Copyright © 2017. All rights reserved.