A Stream in Java can be defined as a sequence of elements from a source, such as arrays, List, Set or any other collection.
Streams are lazily operated, opposite to collections that must store all the values before it starts processing. Stream is conceptually a pipeline, in which elements are computed on demand.
This page lists down the published tutorials on this blog related to Stream API and its related concepts.
1. Stream Basics
- Introduction to Streams API
- Java 9 Stream API Improvements
- Creating Streams
- Functional Interfaces
- Generic Functional Interfaces
- Primitive Type Streams
- Using ‘if-else’ Conditions with Streams
- Creating Infinite Streams
- Stream of Random Numbers
- Boxed Streams
- Stream of Dates
- Remove/Update Elements From List using Stream
- Iterate with Indices
- [Solved] “Stream has already been operated upon or closed” Exception
2. Stream Searching, Filtering and Sorting
- Getting Distinct Stream Items by Comparing Multiple Fields
- Getting the Last Item of a Stream
- Get Object with Max Date From a List
- Find, Count and Remove Duplicates
- Applying Multiple Conditions on Java Streams
- Sorting a Stream by Multiple Fields
- Sorting Streams in Java
- Chaining Multiple Predicates in Java
- Negating a Predicate
- Finding Max and Min from List using Streams
- Java Stream count() Matches with filter()
- Filter a Map by List of Keys
3. Stream Collectors
- Collecting Stream Items into List
- Collecting Stream Items into Map
- Collect a Java Stream to an Immutable Collection
- Collectors groupingBy
4. Stream Conversions
- Converting Between Stream and Array
- Convert Iterable or Iterator to Stream
- Collecting Stream of Primitives into Collection or Array
5. Stream Operations
- Append or Prepend Items to a Stream
- Merging Streams
- Java Stream reuse – Traverse stream multiple times?
6. Stream API and Methods
- Guide to IntStream in Java
- Streams peek() API
- Difference Between map() and flatMap()
- Stream findFirst() vs. findAny()
- Java Stream findAny()
- Java Stream findFirst()
- Java Collectors teeing()
- Java Stream concat()
- Java Stream toArray()
- Java Stream noneMatch()
- Java Stream allMatch()
- Java Stream anyMatch()
- Java Stream skip()
- Java Stream limit()
- Java Stream peek()
- Java Stream flatMap()
- Java Stream map()
- Java Stream min()
- Java Stream max()
- Java Stream sorted()
- Java Stream filter()
- Java Stream forEachOrdered()
- Java Stream forEach()
- Java Stream distinct()
7. Advance Topics
- Listing All Files in a Directory in Java
- Reading a File Line by Line in Java
- How To Debug Java Streams