- 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
605 Views
ToDoubleFunction is a functional interface defined in java.util.function package. This functional interface expects a parameter as input and produces a double-valued result. It is used as an assignment target for a lambda expression or method reference. ToDoubleFunction interface contains only one abstract method, applyAsDouble().Syntax@FunctionalInterface public interface ToDoubleFunction { double applyAsDouble(T value); }Example-1import java.util.function.ToDoubleFunction; ... Read More
raja
14K+ Views
The Runnable interface is a functional interface defined in java.lang package. This interface contains a single abstract method, run() with no arguments. When an object of a class implementing this interface used to create a thread, then run() method has invoked in a thread that executes separately.Syntax@FunctionalInterface public interface Runnable { void run(); ... Read More
raja
3K+ Views
JavaFX Button class provides the setOnAction() method that can be used to set an action for the button click event. An EventHandler is a functional interface and holds only one method is the handle() method.Syntax@FunctionalInterface public interface EventHandler extends EventListenerIn the below example, we can able to implement event handling of JavaFX ... Read More
raja
276 Views
The DoubleFunction is a built-in functional interface defined in java.util.function package. This interface accepts one double-valued parameter as input and returns a value of type R. As this is a functional interface, it can be used as an assignment target for a lambda expression or method reference. DoubleFunction interface having only one abstract method, ... Read More
raja
2K+ Views
A prime number is a number that is greater than 1 and divided by 1 or itself only. It other words, it can't be divided by other numbers than itself or 1. The generation of prime numbers is 2, 3, 5, 7, 11, 13, 17 and etc.In the below example, we can generate the prime numbers with the ... Read More
raja
362 Views
IntFunction interface is a functional interface in Java 8 and defined in java.util.function package. This interface accepts an int-valued parameter as input and returns a value of type R. IntFunction interface can be used as an assignment target for a lambda expression or method reference and holds only one abstract method, apply().Syntax@FunctionalInterface public interface IntFunction { R ... Read More
raja
3K+ Views
The Fibonacci is a sequence of numbers in which every number after the first two numbers is the sum of the two preceding numbers like 0, 1, 1, 2, 3, 5, 8, 13, 21 and so on. The sequence of Fibonacci numbers defined by using "F(n)=F(n-1)+F(n-2)".In the below example, we can implement ... Read More
raja
1K+ Views
Java 8 introduced changes in the Comparator interface that allows us to compare two objects. These changes help us to create comparators more easily. The first important method added is the comparing() method. This method receives as a parameter Function that determines the value to be compared and creates Comparator. Another important ... Read More
raja
2K+ Views
A Map is a collection object that maps keys to values in Java. The data can be stored in key/value pairs and each key is unique. These key/value pairs are also called map entries.In the below example, we can populate a Map using a lambda expression. We have passed Character and Runnable arguments to Map object and ... Read More
raja
226 Views
The ObjIntConsumer interface is a kind of functional interface and defined in java.util.function package. This functional interface expects an object-valued and int-valued argument as input and does not produce any output. It holds only one functional method, accept(Object, int).Syntax@FunctionalInterface public interface ObjIntConsumer { void accept(T t, int value) }In the ... Read More