top of page

Java 8 coding preparation

  • Writer: Anand Nerurkar
    Anand Nerurkar
  • Oct 3, 2023
  • 1 min read

Updated: Nov 2, 2023


ree

ree

ree

ree

ree



ree
ree
ree

ree

ree
ree
ree

-- if element is repeated , then ans will be wrong


ree

so make use of distnce on stream 1st ,then sort it as below to get correct output


ree

if there is onlt 1 element in array, then exception is thrown


ree

ree

ree

ree


ree

ree

ree
ree

ree
ree

ree


ree

ree

ree

ree
ree
ree

Function.identity return same value which we pass as below

ree

ree

ree

1st approach

===

ree

2nd approach

==


ree

ex:

ree
ree

3rd approach

--

ree

ree

ree

below is the data


ree

ree

ree

ree

ree

Optional

==

We can create optional object by below methos

  1. empty()

this return optional.empty object


2.of(object)

if objct is null. then throw null pointerecxeption


3.ofNullable(obj)- if obj is null, then return optional.empty object


ree

ree


alays check ispresent as below


ree

if obje is null, then it print default value as below


ree

or you can throw exception


ree


 
 
 

Recent Posts

See All
Open Banking Vs Tradinal Banking

1. What is Open Banking? Open banking  is a system where banks allow secure sharing of financial data  with authorized third-party...

 
 
 
How To Validate Architecture

🧭 1️⃣ What Architecture Validation Means It’s the structured process of verifying that the proposed or implemented solution : Meets...

 
 
 

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