- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Raja has Published 760 Articles
raja
174 Views
LongPredicate is a functional interface defined in java.util.function package. This interface can be used mainly for evaluating an input of type long and returns an output of type boolean. LongPredicate can be used as an assignment target for a lambda expression or method reference. It contains one abstract method: test() and three default methods: and(), negate() ... Read More
raja
3K+ Views
A constructor reference is similar to method reference except that the name of a method is new. We can also create a constructor reference with an array type. For instance, if we need to create an integer array by using the constructor reference: int[]:: new, where the parameter is a length of an array.SyntaxArrayTypeName[]::newExample@FunctionalInterface ... Read More
raja
7K+ Views
A method reference can also be applicable to constructors in Java 8. A constructor reference can be created using the class name and a new keyword. The constructor reference can be assigned to any functional interface reference that defines a method compatible with the constructor.Syntax::newExample of Constructor Reference with One Argumentimport java.util.function.*; @FunctionalInterface interface MyFunctionalInterface ... Read More
raja
292 Views
IntBinaryOperator is a functional interface in Java 8 from java.util.function package. This interface expects two parameters of type int as input and produces an int type result. IntBinaryOperator can be used as an assignment target for a lambda expression or method reference. It contains only one abstract method: applyAsInt().Syntax@FunctionalInterface public interface IntBinaryOperator { int applyAsInt(int left, int right) ... Read More
raja
2K+ Views
Function interface is a functional interface from java.util.function package. This interface expects one argument as input and produces a result. Function interface can be used as an assignment target for a lambda expression or method reference. It contains one abstract method: apply(), two default methods: andThen() and compose() and one static method: identity().Syntax@FunctionalInterface ... Read More
raja
343 Views
DoubleSupplier interface is a built-in functional interface defined in java.util.function package. This functional interface doesn’t expect any input but produces a double-valued output. DoubleSupplier interface can be used as an assignment target for lambda expression and method reference. This interface contains only one abstract method: getAsDouble().Syntax@FunctionalInterface public interface DoubleSupplier { double getAsDouble(); }Example of Lambda Expressionimport ... Read More
raja
11K+ Views
The functional interface is a simple interface with only one abstract method. A lambda expression can be used through a functional interface in Java 8. We can declare our own/custom functional interface by defining the Single Abstract Method (SAM) in an interface.Syntaxinterface CustomInterface { // abtstact method }Example@FunctionalInterface interface CustomFunctionalInterface { void display(); } public ... Read More
raja
193 Views
ObjLongConsumer is a functional interface from java.util.function package. This interface accepts an object-valued and long-valued argument as input but doesn't produce any output. ObjLongConsumer can be used as an assignment target for lambda expression and method reference and contains only one abstract method: accept().Syntax@FunctionalInterface public interface ObjLongConsumer { void accept(T t, long value) }Exampleimport java.util.function.ObjLongConsumer; ... Read More
raja
2K+ Views
A functional interface is a special kind of interface with exactly one abstract method in which lambda expression parameters and return types are matched. It provides target types for lambda expressions and method references.Rules for a functional interfaceA functional interface must have exactly one abstract method.A functional interface has any number of ... Read More
raja
211 Views
LongFunction is an in-built functional interface defined in java.util.function package. This functional interface expects a long-valued parameter as input and produces a result. LongFunction interface can be used as an assignment target for a lambda expression or method reference. It contains only one abstract method: apply().Syntax@FunctionalInterface public interface LongFunction { R apply(long value) }Exampleimport java.util.function.LongFunction; ... Read More