简体   繁体   中英

How UUID:: randomUUID interpreted?

I know that in Java 8 , (String[]::new) is interpreted as : size-> new String[].

I am eager to know how (UUID :: randomUUID) is interpreted? It is used as Stream.generate(UUID :: randomUUID). But, I wanna know, what exactly is meant by UUID :: randomUUID

How generator function acts here?

UUID::randomUUID is a method reference to the randomUUID method on UUID.

Generate accepts a Supplier , and UUID.randomUUID fufills that Functional Interface .

In short, String[]::new may have special behavior, but arrays are an exception, not the normal rule, and I hadn't actually previously thought about the size needing to be defined.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM