https://kotlinlang.org logo
#functional
Title
# functional
d

Dalinar

02/13/2019, 3:19 PM
Copy code
CompletableFuture.supplyAsync(Supplier<Boolean>{
                    true
                }, pool)
so if I want the
, pool
then I need to use
Supplier<>
? there is no way to get of it ? I'm asking because if you only supply one parameter then it is not necessary
p

pivovarit

02/17/2019, 11:33 AM
Well, it’s obligatory to provide a computation to run, it’s optional to provide a custom pool
So yes, you always need to pass
Supplier<T>
, pool
can be skipped but the method signature remains the same
d

Dalinar

02/21/2019, 6:09 PM
I just meant I was asking if there is no way to use the nicer syntax { } that you can use when there is no pool parameter. For some reason it requires Supplier<Boolean> if a second parameter is passed
p

pivovarit

02/21/2019, 10:07 PM
You can just do
CompletableFuture.supplyAsync({ true }, pool)
18 Views