Package java.util.function - Quiz
Total: 17 questions
1. Enumerate the most commonly used functional interfaces.
Enumerate the most commonly used functional interfaces.
Predicate, Consumer, Supplier, Function and UnaryOperator.
2. The purpose of binary specializations of Predicate, Consumer, Function and UnaryOperator common interfaces.
The purpose of binary specializations of Predicate, Consumer, Function and UnaryOperator common interfaces.
The Predicate, Consumer, Function and UnaryOperator functional interfaces represent an operation that takes one argument. Their binary versions take two arguments called. They have the same semantics, the only difference is the number of arguments.
3. The binary version of the Consumer interface.
The binary version of the Consumer interface.
BiConsumer<T, U>
4. The binary version of the Function interface.
The binary version of the Function interface.
BiFunction<T, U, R>
5. The binary version of the Predicate interface.
The binary version of the Predicate interface.
BiPredicate<T, U>
6. The binary version of the UnaryOperator interface.
The binary version of the UnaryOperator interface.
BinaryOperator<T>
7. The purpose of primitive specializations of Predicate, Consumer, Function, Supplier and UnaryOperator common interfaces.
The purpose of primitive specializations of Predicate, Consumer, Function, Supplier and UnaryOperator common interfaces.
Primitive specializations give the possibility to avoid autoboxing operations when the inputs or outputs are primitives.
8. Rewrite the example using primitive specialization:
Consumer<Integer> ic = i -> System.out.println(++i);
ic.accept(8);
ic.accept(9);
Rewrite the example using primitive specialization:
Consumer<Integer> ic = i -> System.out.println(++i);
ic.accept(8);
ic.accept(9);IntConsumer ic = i -> System.out.println(++i);
ic.accept(8);
ic.accept(9);
9. Enumerate primitive specializations of Consumer functional interface.
Enumerate primitive specializations of Consumer functional interface.
IntConsumer
LongConsumer
DoubleConsumer
10. Enumerate consuming primitive specializations of the Function functional interface.
Enumerate consuming primitive specializations of the Function functional interface.
IntFunction<R>
LongFunction<R>
DoubleFunction<R>
11. Enumerate producing primitive specializations of the Function functional interface.
Enumerate producing primitive specializations of the Function functional interface.
ToIntFunction<T>
ToLongFunction<T>
ToDoubleFunction<T>
12. Enumerate producing/consuming primitive specializations of the Function functional interface.
Enumerate producing/consuming primitive specializations of the Function functional interface.
IntToDoubleFunction
IntToLongFunction
LongToDoubleFunction
LongToIntFunction
DoubleToIntFunction
DoubleToLongFunction
13. Enumerate primitive specializations of Supplier functional interface.
Enumerate primitive specializations of Supplier functional interface.
BooleanSupplier
IntSupplier
LongSupplier
DoubleSupplier
14. Enumerate primitive specializations of UnaryOperator functional interface.
Enumerate primitive specializations of UnaryOperator functional interface.
IntUnaryOperator
LongUnaryOperator
DoubleUnaryOperator
15. Enumerate primitive specializations of BinaryOperator functional interface.
Enumerate primitive specializations of BinaryOperator functional interface.
IntBinaryOperator
LongBinaryOperator
DoubleBinaryOperator
16. Enumerate primitive specializations of BiConsumer functional interface.
Enumerate primitive specializations of BiConsumer functional interface.
ObjIntConsumer<T>
ObjLongConsumer<T>
ObjDoubleCumsumer<T>
17. Enumerate primitive specializations of BiFunction functional interface.
Enumerate primitive specializations of BiFunction functional interface.
ToIntBiFunction<T, U>
ToLongBiFunction<T, U>
ToDoubleBiFunction<T, U>