- 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 34472 Articles for Programming
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
58 Views
The flatMap() method in LongStream class returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.The syntax is as follows −LongStream flatMap(LongFunction
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
63 Views
The forEachOrdered() method in Java performs an action for each element of this stream, guaranteeing that each element is processed in encounter order for streams that have a defined encounter order.The syntax is as follows −void forEachOrdered(LongConsumer action)Here, parameter wrapper is a non-interfering action to perform on the elements. LongConsumer represents an operation that accepts a single long-valued argument and returns no result.To use the LongStream class in Java, import the following package −import java.util.stream.LongStream;The following is an example to implement LongStream forEachOrdered() method in Java −Example Live Demoimport java.util.*; import java.util.stream.LongStream; public class Demo { public static void ... Read More
![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
![Jennifer Nicholas](https://www.tutorialspoint.com/assets/profiles/13569/profile/60_88876-1512715262.jpg)
601 Views
To check connectivity of a graph, we will try to traverse all nodes using any traversal algorithm. After completing the traversal, if there is any node, which is not visited, then the graph is not connected.For the directed graph, we will start traversing from all nodes to check connectivity. Sometimes one edge can have the only outward edge but no inward edge, so that node will be unvisited from any other starting node.In this case the traversal algorithm is recursive BFS traversal.Input − Adjacency matrix of a graph0100000100000111000001000Output − The Graph is connected.Algorithmtraverse(s, visited)Input: The start node s and the ... 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