Home  >  Article  >  Java  >  How to use java Function

How to use java Function

王林
王林forward
2023-05-14 23:52:041777browse

Explanation

1.Function is a new feature of JDK1.8, which represents a function that receives parameters and generates results.

2. The function of the Function interface is that we can provide it with raw materials and it can produce the final product. Processed through the default methods, combinations, and links it provides.

Examples

Function<String, Integer> toInteger = Integer::valueOf;
Function<String, String> backToString = toInteger.andThen(String::valueOf);
 
backToString.apply("123");     // "123"

What collection classes are there in Java

Collections in Java are mainly divided into four categories:

1, List List: ordered, repeatable;

2, Queue queue: ordered, repeatable;

3, Set collection: non-repeatable;

4, Map mapping: unordered, unique keys, non-unique values.

The above is the detailed content of How to use java Function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete