java - Calling Java8 method with BiFunction parameter fro Groovy -


i have piece of groovy code makes use of java8 completablefutures:

       completablefuture<integer> future1 = completablefuture.supplyasync({             thread.sleep(1500)             return 1         })          completablefuture<integer> future2 = completablefuture.supplyasync({             thread.sleep(1000)             return 2         })          def closure = { integer a, integer b -> + b }         completablefuture<integer> result = future1.thencombineasync(future2, closure)         println(result.get()) 

problem can't call thencombineasync in 2nd last line work. whatever do, second argument, required bifunction, not accepted compiler types don't match. i've tried lot of things. solution gets accomplished appreciated.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -