Lazy and Eager operation in Java

  Lazy and Eager Operation In Java

The arrival of Java 8 features brings a great clear and clean function to operation
that are and aren’t lazy in Java

   What is Lazy Operation ?

Operation that aren’t evaluated until a terminal operation is performed, which lead to new stream.

       Where is Lazy Operation applied ?

REAL LIFE : Task B :  Find the first ten applicants in 1,000,000 applicants who applied to the company’s advert from location (“IBADAN”), lazy Operation can be invoked to the system to look for the defined task, and end the operation with  EAGER OPERATION  soon as the task is achieved

Types of Lazy Operation ?
filter , distinct , limit , map and sorted

      What is Eager Operation ?

Operation that immediately process the items in the stream in pipelines.

 What is Stream ?

They are objects of classes that implement  interface Stream from ( ) package

    What is Stream Pipelines ?

The movement of elements through a different sequence of process

  Types of Lazy Operation ?

The are classified based on their funtions

1. Search function  (  findFirst , findAny , anyMatch, allMatch )

2. Container creator ( collect , toArray )

3. Single value returner  ( average, count, max, min ,reduce )

and lastly forEach ( this is not part of the three defined type ), it only process
every three element in the stream

Do you like this article ?
Yes ! Read real life application of lazy and eager operation ….


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

Up ↑

%d bloggers like this: