Home > Java > javaTutorial > body text

A brief introduction to the function package in Java

不言
Release: 2018-10-19 16:25:40
forward
4420 people have browsed it

This article brings you a brief introduction to the function package in Java. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

There are a total of 43 interfaces under the function package. Well, it seems that there are still a lot of them. Don’t be afraid, in fact, there are only 5 categories to get the best results:
Function, Supplier, Consumer, Predicate, Operator. Judging from this, there are very few. That's not all, they have many similarities. If we classify and draw inferences based on these similarities, it will be much simpler. Here we first classify these 43 interfaces according to these common points:

Function class

Union: Function

original type

As parameters: DoubleFunction, IntFunction, LongFunction

As return values: ToDoubleFunction, ToIntFunction, ToLongFunction

Mutual conversion: DoubleToIntFunction, DoubleToLongFunction, IntToDoubleFunction, IntToLongFunction, LongToDoubleFunction, LongToIntFunction

Binary: BiFunction

Original type

As return value: ToDoubleBiFunction, ToIntBiFunction, ToLongBiFunction

Supplier class

One yuan: Supplier

Original type

As return value: BooleanSupplier, DoubleSupplier, IntSupplier, LongSupplier

Consumer class

One yuan: Consumer

Original type

As parameters:DoubleConsumer,IntConsumer,LongConsumer

Binary:BiConsumer

Original type

As parameters:ObjDoubleConsumer,ObjIntConsumer, ObjLongConsumer

Predicate class

One element: Predicate

Primitive type

As parameters: DoublePredicate, IntPredicate, LongPredicate

Binary: BiPredicate

Operator class

Uniary: UnaryOperator

Original type

As both parameter and return value: DoubleUnaryOperator, IntUnaryOperator, LongUnaryOperator

Binary: BinaryOperator

Primitive type

As both parameter and return value: DoubleBinaryOperator, IntBinaryOperator, LongBinaryOperator

The above is the detailed content of A brief introduction to the function package in Java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!