top of page

Java 8 stream hidden features

  • Writer: Anand Nerurkar
    Anand Nerurkar
  • Apr 25, 2024
  • 1 min read
ree

we can make use of

Stream.ofNullable - return the same result as above

ree

2.stream.iterate()- create infinite stream, creating certain pattern like 0,2,4,6,8.......

ree

This create infinite stream


ree

To break this infinite stream, we need to add termination, so we make use of limit as below

ree

Collectors.collectingAndThen

ree

to perform addtional transformation on collectors.

for ex: avg salary of employee

ree

stream.takeWhile, stream.dropWhile

ree

ree

ree

Collectors.teeing()

allows you to collect 2 collectors parallel and combine the result.

ree
ree

ree

Collectors.partioningBy

allows you to partition a stream by certain condition

ree
ree

 
 
 

Recent Posts

See All
AI Risk Metrices

🏦 KEY BANKING RISK METRICS (EXPLAINED SIMPLY) 🔍 What is AUC  (in Credit / Risk Models)? AUC = Area Under the ROC Curve In simple terms: AUC measures how well a model can distinguish between good and

 
 
 
Gen AI USe case Estimation

✅ How to Build Estimation for a GenAI Use Case Step 1: Identify the Use Case Scope What business problem are you solving? (Customer support, document processing, fraud detection, etc.) Who are the end

 
 
 

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
  • Facebook
  • Twitter
  • LinkedIn

©2024 by AeeroTech. Proudly created with Wix.com

bottom of page