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
Ops Efficiency 30 % improvement

how did you achieve 30 % operational efficiency Achieving 30% operational efficiency in a BFSI-grade, microservices-based personal...

 
 
 
Mutual Fund Architecture Q & A

🔹 Q1: How did you design for 100K+ concurrent users and 5K+ TPS? Structured Answer: To support 100K+ concurrent users and 5K+ TPS, I...

 
 
 

Comentarios

Obtuvo 0 de 5 estrellas.
Aún no hay calificaciones

Agrega una calificación
  • Facebook
  • Twitter
  • LinkedIn

©2024 by AeeroTech. Proudly created with Wix.com

bottom of page