top of page

Java 8 coding preparation

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

Updated: Nov 2, 2023











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



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


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
















Function.identity return same value which we pass as below



1st approach

===


2nd approach

==


ex:

3rd approach

--




below is the data






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





alays check ispresent as below


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


or you can throw exception




 
 
 

Recent Posts

See All
📘 Chapter 14:

Future of BFSI – AI-First, Composable Banking 1. The Shift Has Already Begun Banking is no longer just about: Accounts Transactions Branches It is becoming: Intelligent Real-time Platform-driven Embed

 
 
 
📘 Chapter 13:

Execution Playbook (Step-by-Step Transformation Guide) 1. Why Most Transformations Fail Before we begin, let’s address the reality. ❗ Common Reasons for Failure: No clear business alignment Technology

 
 
 

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
  • Facebook
  • Twitter
  • LinkedIn

©2026 by AeeroTech. Proudly created with Wix.com

bottom of page