Skip to content

Commit

Permalink
refactor: remove var usage
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Mar 29, 2024
1 parent 1160f44 commit 9d6b6eb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public interface AsyncEdgeAction<S extends AgentState> extends Function<S, Compl

static <S extends AgentState> AsyncEdgeAction<S> edge_async(EdgeAction<S> syncAction ) {
return t -> {
var result = new CompletableFuture<String>();
CompletableFuture<String> result = new CompletableFuture<>();
try {
result.complete(syncAction.apply(t));
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface AsyncNodeAction<S extends AgentState> extends Function<S, Compl

static <S extends AgentState> AsyncNodeAction<S> node_async(NodeAction<S> syncAction ) {
return t -> {
var result = new CompletableFuture<Map<String, Object>>();
CompletableFuture<Map<String, Object>> result = new CompletableFuture<>();
try {
result.complete(syncAction.apply(t));
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public interface AsyncFunction<T,R> extends Function<T, CompletableFuture<R>> {

static <T> AsyncFunction<T,Void> consumer_async(java.util.function.Consumer<T> syncConsumer ) {
return t -> {
var result = new CompletableFuture<Void>();
CompletableFuture<Void> result = new CompletableFuture<>();
try {
syncConsumer.accept(t);
result.complete(null);
Expand All @@ -20,7 +20,7 @@ static <T> AsyncFunction<T,Void> consumer_async(java.util.function.Consumer<T> s
}
static <T,R> AsyncFunction<T,R> function_async(java.util.function.Function<T,R> syncFunction ) {
return t -> {
var result = new CompletableFuture<R>();
CompletableFuture<R> result = new CompletableFuture<>();
try {
result.complete(syncFunction.apply(t));
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ default CompletableFuture<Void> forEachAsync( final AsyncFunction<T,Void> consu
});
}

@Override
default Iterator<T> iterator() {
return new Iterator<>() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public final boolean close() {
public final CompletableFuture<Data<E>> next() {
return CompletableFuture.supplyAsync( () -> {
try {
var result = queue.poll(timeout, timeoutUnit);
Item<E> result = queue.poll(timeout, timeoutUnit);
if( result == null ) {
queue = null;
throw new RuntimeException( format("queue exceed the poll timeout %d %s", timeout, timeoutUnit) );
Expand Down

0 comments on commit 9d6b6eb

Please sign in to comment.