Member-only story

Java Streams — Part 1

Introduction — The What and Why

KRISHNA KISHORE V
7 min readMay 23, 2022
Fig 1.1 Streams image generated using draw.io

Welcome to yet another series on Java Streams. In this article, we will get ourselves introduced to streams and in the next article, we will look at the top 10 patterns of building the Java streams. Let's get started with what it is?

What is a Stream?

From a general point of view, a Stream is a continuous sequence or flow of some elements.

From a pure Java technical point of view, a Stream is a typed interface as shown below.

public interface Stream<T> extends BaseStream<T, Stream<T>> {}

In Java, the Stream interface represents a sequence, maybe finite or not-finite, of elements of type T. A Stream is said to be bounded if it contains finite elements or unbounded if doesn’t represent a finite number of elements.

What does a Stream Contain?

Maybe, because of the fact that a Stream represents a continuous flow of data, we may tend to think that it holds the data. But it does not. Yes, a Stream does NOT contain any data. Instead, it pulls the data from a particular source. This is very important to keep in mind. The Stream does not hold any data. It puls the data from a data source and processes them. The Stream just acts as…

--

--

KRISHNA KISHORE V
KRISHNA KISHORE V

Written by KRISHNA KISHORE V

Full Stack Tech Lead | Software Consultant | Technical Content Writer

No responses yet