Package | Description |
---|---|
javascalautils |
Introducing some of the core concepts of Scala into Java.
The aim with these utility classes is to provide neat and concise programming patterns. Details and Wiki can be found at: https://github.com/pnerg/java-scala-util |
javascalautils.concurrent |
Contains utilities for concurrent/asynchronous programming.
|
Modifier and Type | Class and Description |
---|---|
class |
None<T>
Represents an empty
Option . |
class |
Some<T>
Represents an
Option holding a value. |
Modifier and Type | Method and Description |
---|---|
static <T> Option<T> |
Option.apply(T value)
|
default Option<T> |
Try.asOption()
|
static <T> Option<T> |
Option.empty()
Returns an empty Option.
In practice this returns a singleton as it anyways cannot represent a value/state. |
Option<Either<L,R>> |
LeftProjection.filter(java.util.function.Predicate<L> predicate)
|
Option<Either<L,R>> |
RightProjection.filter(java.util.function.Predicate<R> predicate)
|
default Option<T> |
Option.filter(java.util.function.Predicate<T> p)
Returns this Option if it is nonempty and applying the predicate p to this Option's value returns
true . |
default Option<T> |
Option.filterNot(java.util.function.Predicate<T> p)
Returns this Option if it is nonempty and applying the predicate p to this Option's value returns
false . |
<R> Option<R> |
None.flatMap(java.util.function.Function<T,Option<R>> function)
Always returns
this . |
<R> Option<R> |
Option.flatMap(java.util.function.Function<T,Option<R>> function)
Returns an Option consisting of the result of applying the given function to the current
Some . |
<R> Option<R> |
Some.flatMap(java.util.function.Function<T,Option<R>> function)
Returns an Option consisting of the result of applying the given function to the current value.
|
<R> Option<R> |
None.map(java.util.function.Function<T,R> f)
Always returns
this . |
<R> Option<R> |
Option.map(java.util.function.Function<T,R> function)
Returns an Option consisting of the result of applying the given function to the current
Some . |
<R> Option<R> |
Some.map(java.util.function.Function<T,R> f)
Returns an Option consisting of the result of applying the given function to the current value.
|
static <T> Option<T> |
Option.None()
Returns an empty Option.
This is the same as empty() but with the difference it provides a more Scala like feeling if the method is statically imported. |
static <T> Option<T> |
Option.ofOptional(Optional<T> optional)
|
Option<T> |
None.orElse(java.util.function.Supplier<Option<T>> s)
Always the value provided by the supplier.
|
Option<T> |
Option.orElse(java.util.function.Supplier<Option<T>> supplier)
Returns this Option if it is nonempty, otherwise return the result of provided by the supplier.
|
Option<T> |
Some.orElse(java.util.function.Supplier<Option<T>> s)
Always returns
this . |
Modifier and Type | Method and Description |
---|---|
<R> Option<R> |
None.flatMap(java.util.function.Function<T,Option<R>> function)
Always returns
this . |
<R> Option<R> |
Option.flatMap(java.util.function.Function<T,Option<R>> function)
Returns an Option consisting of the result of applying the given function to the current
Some . |
<R> Option<R> |
Some.flatMap(java.util.function.Function<T,Option<R>> function)
Returns an Option consisting of the result of applying the given function to the current value.
|
Option<T> |
None.orElse(java.util.function.Supplier<Option<T>> s)
Always the value provided by the supplier.
|
Option<T> |
Option.orElse(java.util.function.Supplier<Option<T>> supplier)
Returns this Option if it is nonempty, otherwise return the result of provided by the supplier.
|
Option<T> |
Some.orElse(java.util.function.Supplier<Option<T>> s)
Always returns
this . |
Modifier and Type | Method and Description |
---|---|
Option<Try<T>> |
Future.value()
The value of the future.
|
Copyright © 2015. All rights reserved.