| Package | Description |
|---|---|
| org.opencastproject.util |
Utility classes for dealing with media packages, collections, URLs, files, and streams.
|
| org.opencastproject.util.data | |
| org.opencastproject.util.data.functions |
| Modifier and Type | Method and Description |
|---|---|
static Function0<InputStream> |
IoSupport.fileInputStream(File a)
Create a function that creates a
FileInputStream. |
| Modifier and Type | Method and Description |
|---|---|
<A> Option<A> |
NeedleEye.apply(Function0<A> f)
Apply function
f only if no other thread currently applies a function using this needle eye. |
static <A,Err,B extends Closeable> |
IoSupport.withResource(Function0<B> r,
Function<Exception,Err> toErr,
Function<B,A> f)
Handle a closeable resource inside
f and ensure that r gets closed properly. |
static <A,Err> Either<Err,A> |
IoSupport.withStream(Function0<InputStream> s,
Function<Exception,Err> toErr,
Function<InputStream,A> f)
|
| Modifier and Type | Class and Description |
|---|---|
class |
Effect0
Run a side effect.
|
static class |
Effect0.X
Version of
Effect0 that allows for throwing a checked exception. |
static class |
Function0.X<A>
Version of
Function0 that allows for throwing a checked exception. |
| Modifier and Type | Method and Description |
|---|---|
Function0<B> |
Function.curry(A a)
Currying.
|
static <A> Function0<A> |
Option.error(String message)
Deprecated.
use
Option.orError(Throwable) or Option.orElse(Function0) instead since it saves the need for
creating new objects just for the sake of type soundness. Java unfortunately lacks a bottom type. |
Function0<B> |
Function.o(Function0<? extends A> f)
Function composition.
|
<B> Function0<B> |
Function0.then(Function<A,B> f)
Apply this function, then pass the result to
f. |
<B> Function0<B> |
Function0.then(Function0<B> f)
Apply this function and ignore its result, then apply
f. |
Function0<Void> |
Effect0.toFunction()
Return the effect as a function of arity 0.
|
| Modifier and Type | Method and Description |
|---|---|
Function<A,Function0<B>> |
Function.curry()
Currying.
|
| Modifier and Type | Method and Description |
|---|---|
<B> Option<B> |
Option.andThen(Function0<Option<B>> some)
Lazy version of
Option.andThen(Option). |
<B> Option<B> |
Option.andThenV(Function0<B> some)
Lazy version of
Option.andThenV(Object). |
static <A,B> Monadics.Matcher<A,B> |
Monadics.caseNil(Function0<B> f)
Matches the empty list.
|
<B> B |
Option.fold(Function<A,B> some,
Function0<B> none)
Safe decomposition of the option type using functions.
|
static <K,V> V |
Collections.getOrCreate(Map<K,V> map,
K key,
Function0<V> f)
Get a value from a map, creating and adding a new one, if the value is missing, i.e.
|
abstract A |
Option.getOrElse(Function0<A> none)
Get the contained value in case of being "some" or return the result of evaluating
none otherwise. |
static <A> Lazy<A> |
Lazy.lazy(Function0<A> f) |
static <A> Cell<A> |
Cells.memo(Function0<A> f)
Create a memo cell that calculates
f once and then returns the value. |
Function0<B> |
Function.o(Function0<? extends A> f)
Function composition.
|
Option<A> |
Option.orElse(Function0<Option<A>> none)
Lazy version of
Option.orElse(Option). |
<T extends Throwable> |
Option.orError(Function0<T> none)
Throw exception returned by
none if none. |
<B> Function0<B> |
Function0.then(Function0<B> f)
Apply this function and ignore its result, then apply
f. |
| Constructor and Description |
|---|
Lazy(Function0<A> f)
Create a new lazy value.
|
| Modifier and Type | Field and Description |
|---|---|
static Function0<Boolean> |
Booleans.no
A function that always returns false.
|
static Function0<Boolean> |
Booleans.yes
A function that always returns true.
|
| Modifier and Type | Method and Description |
|---|---|
static <A> Function0<A> |
Functions.constant0(A a)
Constant function that always returns
a. |
static <A,B> Function0<B> |
Functions.curry(Function<? super A,? extends B> f,
A a)
Curry a function of arity 1.
|
static <A extends Exception> |
Misc.error(Class<A> cls,
String msg) |
static <A extends Exception> |
Misc.error(Class<A> cls,
String msg,
Throwable cause) |
static <A> Function0<Option<A>> |
Options.never2() |
static <A,B> Function0<B> |
Functions.o(Function<? super A,? extends B> f,
Function0<? extends A> g)
Function composition:
f . |
static <A,B> Function0<B> |
Functions.then(Function0<? extends A> f,
Function<? super A,? extends B> g)
Left to right composition:
f then g = g(f) |
static <A,B> Function0<B> |
Functions.then(Function0<? extends A> f,
Function0<? extends B> g)
Apply
f and ignore its result, then apply g. |
| Modifier and Type | Method and Description |
|---|---|
static <A,B> Function<A,Function0<B>> |
Functions.curry(Function<A,B> f)
Curry a function of arity 1.
|
| Modifier and Type | Method and Description |
|---|---|
static <A,B> Function0<B> |
Functions.o(Function<? super A,? extends B> f,
Function0<? extends A> g)
Function composition:
f . |
static <A,B> Function0<B> |
Functions.then(Function0<? extends A> f,
Function<? super A,? extends B> g)
Left to right composition:
f then g = g(f) |
static <A,B> Function0<B> |
Functions.then(Function0<? extends A> f,
Function0<? extends B> g)
Apply
f and ignore its result, then apply g. |
static <A,B> Function0<B> |
Functions.then(Function0<? extends A> f,
Function0<? extends B> g)
Apply
f and ignore its result, then apply g. |
static <A> Effect0 |
Functions.toEffect(Function0<A> f)
Turn a function of arity 0 into an effect by discarding its result.
|
Copyright © 2009–2020 Opencast Project. All rights reserved.