We would like to know how to create Callable with method reference.
import java.util.UUID; import java.util.concurrent.Callable; /* w ww . j av a 2 s . com*/ public class Main { public static void main(String... args) { Callable<UUID> callable = UUID::randomUUID; try { System.out.println(callable.call()); } catch (Exception e) { e.printStackTrace(); } } }
The code above generates the following result.