Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
themeEmacs
titleJAVA
@FunctionalInterface
interface FuncB {
	public int calc(int a, int b);
}

@FunctionalInterface
interface FuncA {
	public int calc(int a);
}

FuncA F1 = (int a) -> a+1;
FuncA F2 = (int a) -> a+1;
FuncA F3 = (int a) -> a+1;
FuncB F4 = (int a,int b) -> a+b;
			
Integer input=1;
CompletableFuture<Integer> futureB  
  = CompletableFuture.supplyAsync(() -> input+1F1.calc(1) );			  	

CompletableFuture<Integer> futureC  futureD
	= CompletableFuture.supplyAsync(() -> input+1+2F3.calc(F2.calc(1))  );			

CompletableFuture<Void> combinedFuture 
  = CompletableFuture.allOf(futureB, futureCfutureD);

combinedFuture.get();						

Integer result = futureB.get() + futureCfutureD.get();			
System.out.println(result);

...