-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Needs some compatability code for missing features in Android.
- Loading branch information
1 parent
82db35b
commit 86fa759
Showing
6 changed files
with
56 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package zmq.util.function; | ||
|
||
/** | ||
Represents an operation that accepts two input arguments and returns no result. This is the two-arity specialization of Consumer. | ||
Unlike most other functional interfaces, {@link BiConsumer} is expected to operate via side-effects. | ||
* | ||
* <p>This is a functional interface | ||
* whose functional method is {@link #accept(Object, Object)}. | ||
* | ||
* @param <T> the type of the input to the operation | ||
* | ||
*/ | ||
public interface BiConsumer<T, U> | ||
{ | ||
/** | ||
* Performs this operation on the given argument. | ||
* | ||
* @param t the first input argument | ||
* @param t the second input argument | ||
*/ | ||
void accept(T t, U u); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package zmq.util.function; | ||
|
||
public class Optional<T> | ||
{ | ||
private final T value; | ||
|
||
private Optional(T value) | ||
{ | ||
this.value = value; | ||
} | ||
|
||
public void ifPresent(Consumer<T> consumer) | ||
{ | ||
if (value != null) { | ||
consumer.accept(value); | ||
} | ||
} | ||
|
||
public static <T> Optional<T> ofNullable(T value) | ||
{ | ||
return new Optional<>(value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters