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
How to replan- No outcome after 6 month

⭐ “A transformation program is running for 6 months. Business says it is not delivering the value they expected. What will you do?” “When business says a 6-month transformation isn’t delivering value,

 
 
 
EA Strategy in case of Merger

⭐ EA Strategy in Case of a Merger (M&A) My EA strategy for a merger focuses on four pillars: discover, decide, integrate, and optimize.The goal is business continuity + synergy + tech consolidation. ✅

 
 
 

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