|
Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg This software is released under an open source BSD licence. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfj.data.Either.RightProjection<A,B>
public final class Either.RightProjection<A,B>
A right projection of an either value.
Method Summary | ||
---|---|---|
|
apply(Either<A,F<B,X>> e)
Function application on this projection's value. |
|
|
bind(F<B,Either<A,X>> f)
Binds the given function across this projection's value if it has one. |
|
Either<A,B> |
either()
The either value underlying this projection. |
|
boolean |
exists(F<B,Boolean> f)
Returns false if no value or returns the result of the application of the given
function to the value. |
|
|
filter(F<B,Boolean> f)
Returns None if this projection has no value or if the given predicate
p does not hold for the value, otherwise, returns a left in Some . |
|
boolean |
forall(F<B,Boolean> f)
Returns true if no value or returns the result of the application of the given
function to the value. |
|
void |
foreach(Effect<B> f)
Execute a side-effect on this projection's value if it has one. |
|
Unit |
foreach(F<B,Unit> f)
Execute a side-effect on this projection's value if it has one. |
|
Iterator<B> |
iterator()
Returns an iterator for this projection. |
|
|
map(F<B,X> f)
Map the given function across this projection's value if it has one. |
|
B |
on(F<A,B> f)
The value of this projection or the result of the given function on the opposing projection's value. |
|
B |
orValue(P1<B> b)
The value of this projection or the given argument. |
|
|
sequence(Either<A,X> e)
Anonymous bind through this projection. |
|
Array<B> |
toArray()
Returns a single element array if this projection has a value, otherwise an empty array. |
|
Collection<B> |
toCollection()
Projects an immutable collection of this projection. |
|
List<B> |
toList()
Returns a single element list if this projection has a value, otherwise an empty list. |
|
Option<B> |
toOption()
Returns this projection's value in Some if it exists, otherwise
None . |
|
Stream<B> |
toStream()
Returns a single element stream if this projection has a value, otherwise an empty stream. |
|
B |
value()
The value of this projection or fails with a specialised error message. |
|
B |
valueE(P1<String> err)
Returns the value of this projection or fails with the given error message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public Iterator<B> iterator()
for
-each loop.
iterator
in interface Iterable<B>
public Either<A,B> either()
public B valueE(P1<String> err)
err
- The error message to fail with.
public B value()
public B orValue(P1<B> b)
b
- The value to return if this projection has no value.
public B on(F<A,B> f)
f
- The function to execute if this projection has no value.
public Unit foreach(F<B,Unit> f)
f
- The side-effect to execute.
public void foreach(Effect<B> f)
f
- The side-effect to execute.public <X> Either<A,X> map(F<B,X> f)
f
- The function to map across this projection.
public <X> Either<A,X> bind(F<B,Either<A,X>> f)
f
- The function to bind across this projection.
public <X> Either<A,X> sequence(Either<A,X> e)
e
- The value to bind with.
public <X> Option<Either<X,B>> filter(F<B,Boolean> f)
None
if this projection has no value or if the given predicate
p
does not hold for the value, otherwise, returns a left in Some
.
f
- The predicate function to test on this projection's value.
None
if this projection has no value or if the given predicate
p
does not hold for the value, otherwise, returns a left in Some
.public <X> Either<A,X> apply(Either<A,F<B,X>> e)
e
- The either of the function to apply on this projection's value.
public boolean forall(F<B,Boolean> f)
true
if no value or returns the result of the application of the given
function to the value.
f
- The predicate function to test on this projection's value.
true
if no value or returns the result of the application of the given
function to the value.public boolean exists(F<B,Boolean> f)
false
if no value or returns the result of the application of the given
function to the value.
f
- The predicate function to test on this projection's value.
false
if no value or returns the result of the application of the given
function to the value.public List<B> toList()
public Option<B> toOption()
Some
if it exists, otherwise
None
.
Some
if it exists, otherwise
None
.public Array<B> toArray()
public Stream<B> toStream()
public Collection<B> toCollection()
|
Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg This software is released under an open source BSD licence. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |