| 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.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 <B> B |
UnmodIterable.fold(B ident,
Fn2<? super B,? super T,B> reducer)
Apply the function to each item, accumulating the result in u.
|
default <G,B> Or<G,B> |
UnmodIterable.foldUntil(G accum,
Fn2<? super G,? super T,B> terminator,
Fn2<? super G,? super T,G> reducer)
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 fold().
|
default <G,B> Or<G,B> |
UnmodIterable.foldUntil(G accum,
Fn2<? super G,? super T,B> terminator,
Fn2<? super G,? super T,G> reducer)
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 fold().
|
static <T> void |
UnmodList.permutations(List<T> items,
Fn2<? super T,? super T,?> f)
Apply the given function against all unique pairings of items in the list.
|
| Modifier and Type | Class and Description |
|---|---|
static class |
Fn2.Singletons |
| Modifier and Type | Method and Description |
|---|---|
static <A1,B1> Fn2<A1,? super B1,A1> |
Fn2.first()
Returns a static function that always returns the first argument it is given.
|
static <A,B,Z> Fn2<A,B,Z> |
Fn2.memoize(Fn2<A,B,Z> f)
Use only on pure functions with no side effects.
|
static <A1,B1> Fn2<A1,? super B1,B1> |
Fn2.second()
Returns a static function that always returns the second argument it is given.
|
| Modifier and Type | Method and Description |
|---|---|
static <A,B,Z> Fn2<A,B,Z> |
Fn2.memoize(Fn2<A,B,Z> f)
Use only on pure functions with no side effects.
|
| Modifier and Type | Method and Description |
|---|---|
<B> B |
Xform.fold(B ident,
Fn2<? super B,? super A,B> reducer)
Provides a way to collect the results of the transformation.
|
<U> U |
Transformable.fold(U accum,
Fn2<? super U,? super T,U> reducer)
Apply the function to each item, accumulating the result in u.
|
<G,B> Or<G,B> |
Xform.foldUntil(G accum,
Fn2<? super G,? super A,B> terminator,
Fn2<? super G,? super A,G> reducer)
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.
|
<G,B> Or<G,B> |
Xform.foldUntil(G accum,
Fn2<? super G,? super A,B> terminator,
Fn2<? super G,? super A,G> reducer)
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.
|
<G,B> Or<G,B> |
Transformable.foldUntil(G accum,
Fn2<? super G,? super T,B> terminator,
Fn2<? super G,? super T,G> reducer)
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 fold().
|
<G,B> Or<G,B> |
Transformable.foldUntil(G accum,
Fn2<? super G,? super T,B> terminator,
Fn2<? super G,? super T,G> reducer)
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 fold().
|
Copyright © 2019. All rights reserved.