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 |
Failure<T>
Represents the 'failed' implementation of
Try . |
class |
Success<T>
Represents the 'successful' implementation of
Try . |
Modifier and Type | Method and Description |
---|---|
static <T> Try<T> |
Try.apply(T value)
|
Try<Throwable> |
Success.failed()
Always returns a
Failure with an UnsupportedOperationException . |
Try<Throwable> |
Try.failed()
|
Try<Throwable> |
Failure.failed()
|
<R> Try<R> |
Success.flatMap(java.util.function.Function<T,Try<R>> function) |
<R> Try<R> |
Try.flatMap(java.util.function.Function<T,Try<R>> function)
|
<R> Try<R> |
Failure.flatMap(java.util.function.Function<T,Try<R>> function)
Always returns
this |
<R> Try<R> |
Success.map(java.util.function.Function<T,R> function)
Applies the value to the function and returns the Try representing the mapped value.
|
<R> Try<R> |
Try.map(java.util.function.Function<T,R> function)
|
<R> Try<R> |
Failure.map(java.util.function.Function<T,R> function)
Always returns
this |
Try<T> |
Success.orElse(java.util.function.Supplier<Try<T>> s)
Always returns this.
|
Try<T> |
Try.orElse(java.util.function.Supplier<Try<T>> supplier)
|
Try<T> |
Failure.orElse(java.util.function.Supplier<Try<T>> s)
Always returns the provided default value.
|
Modifier and Type | Method and Description |
---|---|
<R> Try<R> |
Success.flatMap(java.util.function.Function<T,Try<R>> function) |
<R> Try<R> |
Try.flatMap(java.util.function.Function<T,Try<R>> function)
|
<R> Try<R> |
Failure.flatMap(java.util.function.Function<T,Try<R>> function)
Always returns
this |
Try<T> |
Success.orElse(java.util.function.Supplier<Try<T>> s)
Always returns this.
|
Try<T> |
Try.orElse(java.util.function.Supplier<Try<T>> supplier)
|
Try<T> |
Failure.orElse(java.util.function.Supplier<Try<T>> s)
Always returns the provided default value.
|
Modifier and Type | Method and Description |
---|---|
Option<Try<T>> |
Future.value()
The value of the future.
|
Modifier and Type | Method and Description |
---|---|
void |
Future.onComplete(java.util.function.Consumer<Try<T>> completeHandler)
Register a handler to be invoked if the Future gets completed with a value or a failure.
|
Copyright © 2015. All rights reserved.