Optional class in Java

As part of java8 release Optional class introduced to deal with NullPointerExceptions that occur in Java applications. The Optional class is available in the java.util package and acts as a container that holds values which can be either non-null or empty. Create Optional object The constructor of the Optional class is private, so we cannot … Read more

Spring boot application with Mongo

Here, we will learn a step-by-step process for CRUD operations on MongoDB using Spring Boot. create spring boot application using https://start.spring.io/ . select the type of project either Maven/Gradle (here we are using maven), select the dependencies like spring-boot-starter-data-mongodb, spring-boot-starter-web, lombok application.yaml Add the configuration for MongoDB properties such as host, port info, and database … Read more

Employee operations using groupBy

Print the employee names group by designation Print the salary group by country Print the salary group by designation Print employee names based on their location Print the employees whose country is india, if the emp names are matching then compare salary