In this article we will learn how to use optional in java 8 streams. Optional is a container object which may or may not contain null value. Some of the most important methods in Optional’s are . So now lets look into the code on how to use optional in Java 8 stream. In this… Continue reading
Posts by "JBT"
Spring Boot 2 Actuator Endpoint
Here we will talk about the Spring Boot 2 Actuator Endpoints. I will cover below points in this article. At any point you can refer GITHUB repository for Spring Boot 2 Actuator. Enable & Expose Before we work with endpoint, we need to understand the difference between Exposed and Enabled Endpoint. In order to access… Continue reading
package javax.validation.constraints does not exist error in spring boot 2.3
If you are using validation constraints in your Spring Boot application and just migrated to Spring Boot 2.3. You will face an error saving “javax.validation.constraints does not exist“. It happened to me when I tried to migrate Spring-Boot application to JDK 14 and Spring Boot 2.3.
Java 14: instanceOf Pattern Matching
JDK prepares to use pattern matching in future versions. In JDK 12 pattern matching has been implemented in switch expression. And the same is being implemented to instanceOf in JDK 14 as a preview feature. In java program, instanceof include logic that combines testing if an expression has a certain type, and then conditionally extracting… Continue reading
Spring Boot data with H2 Database
In this tutorial, we’ll learn how to use the H2 in-memory database with Spring Boot. Spring Boot support H2 just like any other database. H2 is the open-source Java SQL database. Which is mainly used for testing or POC purposes. Spring boot provides out of the box support for H2 and you don’t need to… Continue reading
Java for loop
Java for loop and enhanced for loop is a type of control flow statement which provides a compact way to iterate over a range of values. for loop repeatedly loops through the code until a particular condition is satisfied. Over the period, Java has added different types of for loop. for loop Enhanced for loop… Continue reading
Switch case statement in Java
A switch statement is a conditional statement that tests against multiple cases and displays one or multiple outputs based on the matching circumstances. Unlike if-then and if-then-else statements, the switch statement can work with byte, short, char, and int primitive data types. It also works with enum types (discussed in Java Enum), the String class, and a few wrapper classes: Character, Byte, Short, and Integer. Important Rules Only constants or literals are allowed in case Duplicate… Continue reading
Data types in Java
Java is a statically-typed language, which means that all variables must first be declared before they can be used. It means the variable’s name and types must be defined before it can be used in code. boolean bool = true; By writing the above line we are telling the program that a variable named bool… Continue reading
Java method parameter and argument
In this article, we will talk about the method parameter and method argument. Please make a note that the method argument and method parameter are sometimes used interchangeably. Parameters refer to the list of variables in a method declaration. Arguments are the actual values that are passed in when the method is invoked. When you invoke a method, the… Continue reading
Java 8 Functional Interfaces
Introduction to functional interfaces A functional interface is an interface that has a single abstract method. Functional interfaces can have multiple static and default methods, but they should have only one abstract method to qualify as a functional interface. Functional interfaces were introduced in Java 8 in order to implement lambda expressions.