Home » Core Java

Core Java

Record Keyword in Java

Bipartite Graph

1. Introduction This is an in-depth article related to Record Keyword in Java. In java, immutable data is passed between objects in applications. In Java 14, Record feature was introduced. Before this feature got introduced, we had to create a class with boilerplate fields and methods. 2. Record Keyword In many scenarios in applications, data is immutable. These scenarios can ...

Read More »

Assert ‘Exception thrown’ Junit

1. Introduction In the Java programming language, an assertion is a statement that enables you to test your program’s presumptions. You predict that each boolean expression in an assertion will be true when the assertion is executed. If it is not true, the system will throw an error. Your assumptions about how your program will behave are confirmed by the ...

Read More »

What is n in Java?

Bipartite Graph

1. Introduction This is an in-depth article related to the n in Java. \n is used for inserting a new line in the text. The control is passed to the next line and text is printed on the new line. 2. \n in Java Adding a new line in java is done by including “\n” at the end of the ...

Read More »

Keytool in Java

Bipartite Graph

1. What is Keytool? A keytool is a command line platform in Java used for storing and generating certificates and private keys. It functions by enabling users to manage and access their public and private key pairs and certificates that are cached by the server due to previous authentifications and used for SSL/TLS connections. Inorder to access the keytool command ...

Read More »

Java streams api – Convert list to map

Bipartite Graph

Hello. In this tutorial, we will understand how to convert a list to a map, using the java streams api collect(Collectors.toMap(…)) method. 1. Introduction Collectors.toMap(…) method returns a new instance of the map with keys as per keyMapper function and values as per the valueMap function. It is represented by the following semantics syntax – Implementation class <T,K,U> Collector<T,?,Map<K,U>> toMap( ...

Read More »

Longest Substring Without Repeating Characters

Bipartite Graph

Hello. In this tutorial, we will implement an important data structure question known as finding the longest substring without repeating characters. 1. Introduction The implementation will talk about three different areas i.e. – Brute force method – Simplest approach to generate substrings having all unique characters from a given string and return the maximum length Sliding window method – Increasing ...

Read More »

Java List add() and addAll() Methods

Bipartite Graph

1. Introduction In every programming language, data structures are very important and it needs to pay more attention to what type of structure you use depending on your use case. There are multiple type of data structure like: Array. Arrays stores items at the adjoining memory location. The items from an array can be easily accessed by an index. Length ...

Read More »

Arrays.aslist in Java

Bipartite Graph

Hello. In this tutorial, we will make understand and implement java.util.Arrays.asList(…) method. 1. Introduction Arrays.asList() method in java is used to create a fixed-size list in java. It is a static method that returns a list of homogeneous elements and does not throw any exceptions. The method is represented by the below syntax and below reports compilation errors if heterogeneous ...

Read More »

Memory Leak in Java

Bipartite Graph

Hello. In this tutorial let us learn about memory management and memory leaks in a java programming language. 1. Introduction Memory management in java is an interesting concept where the memory is divided into three different parts. Fig. 1: Memory management in java Let us understand each part separately. 1.1 Young generation The young generation refers to a place where ...

Read More »

The DTO (Data Transfer Object)

Bipartite Graph

1. Introduction to DTO Having a big application that has multiple layers you will need to “transport” that data between different layers. To transport the data you have to encapsulate it into objects (DTO), that you can easily send it. This type of object doesn’t have any kind of logic, just some accessors,  mutators, and parsers for serialization or deserialization. ...

Read More »