Creates a immutable list (read-only), cannot modify the list once it is created.
List.of(1,2,3);
Set.of(1,2,3);
we can create immutable map in 2 ways:
Map.of(K1,V1,K2,V2); // K refers to key and V refers to value
…
Collectors is a final class that extends Object class. It provides reduction operations, such as accumulating elements into collections, summarizing elements according to various criteria, etc. Java Collectors class provides various methods to deal with elements.
It is used to accumulate elements into a list. It will create a new list (It will not change the current list).
List<Integer> integers = Arrays.asList(1,2,3,4,5,6,6);integers.stream().map(x -> x*x).collect(Collectors.toList());// output: [1,4,9,16,25,36,36]
It is used to accumulate elements into a set, It will remove all the duplicate entries.
List<Integer> integers = Arrays.asList(1,2,3,4,5,6,6);integers.stream().map(x -> x*x).collect(Collectors.toSet());// output: [1,4,9,16,25,36]
We can accumulate data in any…
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
If you are working on any software project, then there are good chances that you already heard of GIT before. In this article we will deep dive into some useful but not so common git commands which can make out life easier.
It is used to store all the local changes (staged and unstaged changes) for future use and reverts them from your working copy. It takes you back to the working directory HEAD (last…
In this blog, we will learn about how we can containerize a react application. Here we will see the generic steps which we can follow with any react application. Just for the sake of completion, we will start from scratch, we will first create a react application and then we will containerize it.
If you just started working on docker, I will highly recommend you to check my other blog first which is moreover related to the basic of docker commands
https://medium.com/swlh/important-docker-commands-you-should-know-60735f821068
npx create-react-app my-app
cd my-app
npm install
The first command will create our project, the second command is…
Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allow you to run many containers simultaneously on a given host.
As per the official website, a Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries, and settings.
And docker container is an instance of the docker image, docker container is a docker image brought to life.
Every docker command can be broken down into 3 parts :
1. Keyword 'docker' 2…
As ECMAScript11 came, let’s quickly revise all the major features of ES6 to ES10.
Its the protocol on which Javascript works. So we can say its javascript version.
The let statement allows us to declare a variable with block scope and we cannot redeclare the same object in the same scope
var x = 10;
{
let x = 2;
let x = 4; // ERROR (cant redeclare)
x = 5; // works fine
// In this block x is equal to 5
}
// here x is 10
The const statement is the same as let, the only difference…
In the last blog, we looked at what is Quarkus. How it works internally. and ways to create a quarkus project. If you have not read that blog yet I will highly recommend you do that first.
In this blog, we will see how we can integrate PostgreSQL with Quarkus and will create a CRUD application.
So let's start with the dependencies
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-panache</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-postgresql</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-validator</artifactId>
</dependency>
These are the 3 dependencies we require for our database connection and validation.
We need to provide the database name, driver…
Quarkus is a full-stack, light-weight, superfast java framework for the JVM and the native application.
But why so hype about Quarkus? Why should we learn Quarkus? when we already have Spring boot like framework. which is an open-source framework. It gives a simple way to build, configure, and build web applications.
So let’s start out talking with the comparison between Quarkus and Spring boot.
If we compare the startup time between the Quarkus native, Quarkus JIT, and traditional native application(Spring boot). We can clearly see the difference.
Asynchronous programming provides a non-blocking, event-driven programming model. This programming model leverages the multiple cores in your system to provide parallelization by using multiple CPU cores to execute the tasks, thus increasing the application’s throughput.
In Java, there are many ways to achieve asynchronous programming or reactive programming like using RxJava, project Reactor, vertX, etc
Here we will discuss the project Reactor using the spring web-Flux module.
Spring Framework 5 includes a new spring-webFlux module. We will achieve the asynchronous services using spring webFlux. It exposes 2 major API types: Flux and Mono. These API works on the concept of…
Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution. All variable and function declarations are hoisted to the top of their scope
However, in contrast, undeclared variables do not exist until code assigning them is executed. Therefore, assigning a value to an undeclared variable implicitly creates it as a global variable when the assignment is executed. This means that all undeclared variables are global variables.
function hoist() { a = 20; var b = 100; } console.log(a); // error a is not defined hoist(); console.log(a); // 20 a…
Full stack developer