Java Stream distinct() with examples

Welcome to Java 8 series. In this tutorial, you will learn about java stream distinct() with examples. distinct() is a part of the Stream pipeline and an intermediate operation. It belongs to the Stream interface. distinct() operation allows us to fetch only distinct elements from the Stream by producing a new stream of distinct data. Method description As per official […]

Java Stream sorted() with examples

Welcome to Java 8 series. In this tutorial, you will learn about java stream sorted() with examples. sorted() allows us to sort the elements in natural order. sorted() is a part of the Stream pipeline and an intermediate operation. It belongs to the Stream interface. Method description As per official documentation, sorted() – Returns a stream consisting of the elements […]

Java Stream peek() with examples

Welcome to Java 8 series. In this tutorial, you will learn about java stream peek() operation with examples. peek() is a part of Stream pipeline and an intermediate operation. It belongs to the Stream interface. Java stream peek() operation allows us to visualize the data or see the elements of the stream for debugging as they flow. peek() should be […]

Java Stream limit() with examples

Welcome to Java 8 series. In this tutorial, you will learn about java stream limit() with examples. limit() is a part of the Stream pipeline and an intermediate operation. It belongs to the Stream interface. Java stream limit operation allows us to limit the number of elements based on the input N.It generates a new stream by limiting N elements. […]

Java Stream skip() with examples

Welcome to Java 8 series. In this tutorial, you will learn about java stream skip() with examples. skip() is a part of Stream pipeline and an intermediate operation. It belongs to the Stream interface. Java stream skip operation allows us to skip first N elements based on the input N.It generated a new stream by discarding the first N elements […]

5 ways to use Java stream filter()

Welcome to Java 8 series. In this tutorial, you will learn about 5 ways to use java stream filter(). filter() is a part of Stream pipeline and it is an intermediate operation filter() belongs to the Stream interface. filter() operation allows us to apply filter conditions on the stream data. A filter will accept a function (a Lambda expression or […]

Java Stream filter() with examples

Welcome to Java 8 series. In this tutorial, you will learn about the Java Stream filter with brief examples. Stream filter() is an intermediate operation and it belongs to the Stream interface. Java stream filter operation allows us to apply filter conditions on the stream data. A filter will accept a function (a Lambda expression or a Predicate interface) which […]

Java Stream terminal operations

Welcome to Java 8 series. In this post, you will learn about Java Stream terminal operations. Java 8 streams are classified into two operations. Intermediate operation and Terminal Operation. Both are combined to form a Stream pipeline. Terminal operation A terminal operation produces the final output. Stream pipeline will end with a single terminal operation such as foreach, count, collect, […]

Java Stream intermediate operations

Welcome to Java 8 series. In this post, you will learn about Java Stream intermediate operations. Java 8 streams are classified into two operations. Intermediate operation and Terminal Operation. Both are combined to form a Stream pipeline. Intermediate operation Stream pipeline can have zero to N number of intermediate operations such as filter, map, etc. The intermediate operation allows us […]

Java 8 Stream pipelines explained

Welcome to Java 8 series and to my post ‘Java 8 Stream pipelines explained’. In this post, you will learn about Stream pipelines, source of a stream, intermediate operation and terminal operations. Java 8 streams are classified into two operations. Intermediate operation and Terminal Operation. Both are combined to form a Stream pipeline. Structure of a Stream pipeline Stream pipeline […]

Java BooleanSupplier Interface with examples

Welcome to Java 8 Series. In this tutorial, you will learn about the Java BooleanSupplier Interface with examples. BooleanSupplier is a Functional interface introduced as part of Java 8. It is available in java.util.function package. What is the use of BooleanSupplier interface? This interface is mainly used for just getting a boolean-valued result which is not based on the input. BooleanSupplier interface doesn’t have any input […]

Scala forall method with examples

Welcome to Scala series. In this tutorial, you will learn about Scala forall method with examples. Scala forall method is used for testing each element of a collection. It is a predicate operation which returns a boolean value based on some validation performed on each item of the collection. Normal way of validating each item in a collection. The below example […]

2 ways to iterate a map in Scala with examples

Welcome to Scala series. In this post, you will learn 2 ways to iterate a map in Scala with examples. Using for loop This is a imperative style programming Output Using foreach This is functional style programming Output These are the 2 ways of iterating a map in Scala. References : Official documentation Please leave us a comment and give us a thumbs […]

2 ways to iterate a Seq in Scala with examples

Welcome to Scala series. In this post, you will learn 2 ways to iterate a Seq in Scala with examples Using for loop This is a imperative style programming Output Using foreach This is functional style programming Output These are the 2 ways of iterating a seq in Scala. References : Official documentation Please leave us a comment and give us a thumbs up!