- 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
Found 4331 Articles for Java 8
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
202 Views
The concat() method in the Java IntStream class forms a concatenated stream. The elements of this stream are all the elements of the first stream followed by all the elements of the second stream.The syntax is as follows −static IntStream concat(IntStream one, IntStream two)Here, the parameter one is the first stream, whereas two is the second stream. The method returns the concatenated result of the stream one and two.Let us create two IntStream and add some elements −IntStream intStream1 = IntStream.of(10, 20, 30, 40, 50); IntStream intStream2 = IntStream.of(60, 70, 80, 90);Now, to concate both the streams, use the concat() ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
70 Views
The equals() method is inherited from the AbstractList class in Java. It is used to check the object for equality with this list. It returns TRUE if the object is equal to this list, else FALSE is returned.The syntax is as follows −public boolean equals(Object o)Here, o is the object to be compared for equality with this list.To work with the AbstractSequentialList class in Java, you need to import the following packageimport java.util.AbstractSequentialList;The following is an example to implement AbstractSequentialList equals() method in JavaExample Live Demoimport java.util.LinkedList; import java.util.AbstractSequentialList; public class Demo { public static void main(String[] args) { ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
84 Views
The subList() method returns a part of this list between the specified fromIndex, inclusive, and toIndex, exclusive. Get a sublist using the method by setting the range as the two parameters.The syntax is as follows −public List subList(int fromIndex, int toIndex)Here, the parameter fromIndex is the low endpoint (inclusive) of the subList, whereas toIndex is the high endpoint (exclusive) of the subListTo work with the AbstractSequentialList class in Java, you need to import the following package −import java.util.AbstractSequentialList;The following is an example to implement AbstractSequentialList subList() method in Java −Example Live Demoimport java.util.LinkedList; import java.util.AbstractSequentialList; public class Demo { ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
72 Views
The set() method of the AbtstractSequentialList class is used to replace the element at the specified position in this list with the specified element. It returns the element which is replaced. The syntax is as follows −E set(int index, E element)Here, the index is the index of the element to replace. The ele is the element to be stored at the specified position.To work with the AbstractSequentialList class in Java, you need to import the following package −import java.util.AbstractSequentialList;The following is an example to implement AbstractSequentialList set() method in Java −Example Live Demoimport java.util.LinkedList; import java.util.AbstractSequentialList; public class Demo { ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
58 Views
The DoubleStream.generate() method returns an infinite sequential unordered stream where each element is generated by the provided DoubleSupplier.The syntax is as follows −static DoubleStream generate(DoubleSupplier s)Here, s is the DoubleSupplier for generated elements. The DoubleSupplier represents a supplier of double-valued results.To use the DoubleStream class in Java, import the following package −import java.util.stream.DoubleStream;The following is an example to generate Infinite stream of Double in Java with DoubleStream.generate() method −Exampleimport java.util.stream.*; import java.util.*; public class Demo { public static void main(String[] args) { Random r = new Random(); DoubleStream.generate(r::nextDouble).forEach(System.out::println); } }Here is ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
9K+ Views
The range() method in the IntStream class in Java is used to return a sequential ordered IntStream from startInclusive to endExclusive by an incremental step of 1. This includes the startInclusive as well.The syntax is as follows −static IntStream range(int startInclusive, int endExclusive)Here, the parameter startInclusive includes the starting value, whereas endExclusive excludes the last valueTo work with the IntStream class in Java, import the following package −import java.util.stream.IntStream;Create an IntStream and add stream elements in a range using range() method. This returns a sequential ordered IntStream by an incremental step of 1 within the range −intStream.forEach(System.out::println);The following is an ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
156 Views
The sum() method of the IntStream class is used in Java to return the sum of elements in this stream.The syntax is as follows −int sum()To work with the IntStream class in Java, import the following package −import java.util.stream.IntStream;Create IntStream and add some elements −IntStream intStream = IntStream.of(50, 100, 150, 200, 250, 300);Now, return the sum of elements in the IntStream added above −int sumVal = intStream.sum();The following is an example to implement IntStream sum() method in Java −Example Live Demoimport java.util.stream.IntStream; public class Demo { public static void main(String[] args) { IntStream intStream = IntStream.of(50, ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
47 Views
An immutable copy of a Period where all the Period elements are negated can be obtained using the method negated() in the Period class in Java. This method requires no parameters and it returns the Period elements after negating them.A program that demonstrates this is given as followsExample Live Demoimport java.time.Period; import java.time.LocalDate; public class Demo { public static void main(String[] args) { String period = "P5Y7M15D"; Period p = Period.parse(period); System.out.println("The Period is: " + p); System.out.println("The Period with elements negated is: " + p.negated()); } ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
3K+ Views
The Period between two dates can be obtained using the between() method in the Period class in Java. This method requires two parameters i.e. the start date and the end date and it returns the Period between these two dates.A program that demonstrates this is given as followsExample Live Demoimport java.time.Period; import java.time.LocalDate; public class Demo { public static void main(String[] args) { LocalDate startDate = LocalDate.parse("2015-03-15"); LocalDate endDate = LocalDate.parse("2019-05-20"); System.out.println("The start date is: " + startDate); System.out.println("The end date is: " + endDate); ... Read More