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
EA Day to Day Activity

🔹 Typical Day-to-Day Activities (Enterprise Architect – Digital Lending Program) 1. Start of Day – Communication & Prioritization Read &...

 
 
 
Bounded Context & Microservices

Use Case: Loan Application Processing A legacy system has PL/SQL packages  and Oracle Forms  handling: Customer KYC Credit Score...

 
 
 

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