- 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
Nancy Den has Published 335 Articles
Nancy Den
94 Views
The mapToDouble() method returns a DoubleStream consisting of the results of applying the given function to the elements of this stream.The syntax is as follows:DoubleStream mapToDouble(LongToDoubleFunction mapper)The parameter mapper is a stateless function to apply to each element.To use the LongStream class in Java, import the following package:import java.util.stream.LongStream;The following ... Read More
Nancy Den
61 Views
To create Decade Tuple from array in Java, use the fromArray() method. Here, we will see how to create a Decade Tuple using the fromArray() method. Let us first see what we need to work with JavaTuples. To work with Decade class in JavaTuples, you need to import the following ... Read More
Nancy Den
77 Views
The generate() method of the LongStream class returns an infinite sequential unordered stream where each element is generated by the provided LongSupplier.The syntax is as follows:static LongStream generate(LongSupplier s)Here, s is the LongSupplier for generate elements. The LongSupplier is the supplier of long-valued results.To use the LongStream class in Java, ... Read More
Nancy Den
62 Views
To create a KeyValue tuple in Java, you can use the with() method. Let us first see what we need to work with JavaTuples. To work with KeyValue class in JavaTuples, you need to import the following package:import org.javatuples.KeyValue;Note: Download JavaTuples Jar library to run JavaTuples program. If you are ... Read More
Nancy Den
65 Views
The builder() method in IntStream class is used to return a builder for an IntStream.The syntax is as follows:static IntStream.Builder builder()Here, we have created an IntStream and used the builder() method. An element is added using add() method:IntStream intStream = IntStream.builder().add(25).build();The following is an example to implement IntStream builder() method ... Read More
Nancy Den
119 Views
The hash code for a particular Instant object can be obtained using the hashCode() method in the Instant class in Java. This method requires no parameters and it returns the hash code for the Instant object.A program that demonstrates this is given as followsExample Live Demoimport java.time.*; import java.time.temporal.ChronoUnit; public class ... Read More
Nancy Den
108 Views
You can also generate Infinite Stream of Integers in Java with IntStream.generate() method. Here, we have used the Random class to get the list of random integers:Random r = new Random();After that use IntStream.generate() and the nextInt() method gets the next random integer:IntStream.generate(r::nextInt)The following is an example displaying how to ... Read More
Nancy Den
740 Views
The equality of two Instant objects can be determined using the equals() method in the Instant class in Java. This method requires a single parameter i.e. the Instant to be compared. Also it returns true if both the Instant objects are equal and false otherwise.A program that demonstrates this is ... Read More
Nancy Den
2K+ Views
Two Instant objects can be compared using the compareTo() method in the Instant class in Java. This method requires a single parameter i.e. the Instant object to be compared.If the first Instant object is greater than the second Instant object it returns a positive number, if the first Instant object ... Read More
Nancy Den
85 Views
An Instant can be combined with a timezone to create a ZonedDateTime object using the atZone() method in the Instant class in Java. This method requires a single parameter i.e. the ZoneID and it returns the ZonedDateTime object.A program that demonstrates this is given as followsExample Live Demoimport java.time.*; public class ... Read More