Home » Core Java

Core Java

Java 8 Convert a String to LocalDate Example

Hello readers, in this tutorial, we will learn how to convert a given response string into a java.time.LocalDate object. 1. Introduction These days in the programming universe Date and Time handling are the most time-consuming tasks in Java. In the ancient Java world, developers were dependent on the complex SimpleDateFormat class to convert and format the Date strings into the ...

Read More »

Java 8 Filter Null Values from a Stream Example

Hello readers, in this tutorial, we will learn how to filter the null elements from a Stream in Java. 1. Introduction Java Stream is a sequence of elements that support the sum operations. In streams, the elements are reckoned on demand from different data sources such as Collections, Arrays or I/O resources and thus the elements are never stored. Streams ...

Read More »

Java 8 Map Sorting Example

Hello readers, in this tutorial, we will learn how to Sort a Map using Java8 Stream’s API and Lambda expression. 1. Introduction These days in the programming universe sorting a map is one of the most habitual tasks in Java. In the ancient Java world, developers could sort a Map either by its keys or values. In Java8, JDK developers ...

Read More »

ByteCode primer for Java Class Files

It is often stated that to be good at the programming language you code in, one should at least dig and understand one abstraction level lower than the one in which you are coding. For Java, that would be the JVM, which would imply byte code. In this article we will kick start our adventures in Java byte code. Byte ...

Read More »

Java 8 Read a File Line by Line Example

Hello readers, in this tutorial, we will learn the Java8 Stream’s API for reading a file’s content line-by-line and we will explore its different characteristics. 1. Introduction These days in the programming universe reading the file content is one of the most habitual files manipulation task in Java. In the ancient Java world, the code to read the text file ...

Read More »

Java 8 StringJoiner Example

Hello readers, in this tutorial, we will learn about the Java8 Stream’s API StringJoiner feature and we will explore its different characteristics. 1. Introduction These days in the programming universe joining multiple strings are a common task among the developers. In the ancient Java world, there was no direct way to join the multiple strings. Java8 has introduced a final ...

Read More »

Java 8 flatMap Example

Hello readers, in this tutorial, we will learn about Java8 Streams API flatMap() method and in which structure it can be used. 1. Introduction A flatMap() method is a Java8 programming operation which takes a single function as an argument. This function accepts the T parameter as an input argument and returns a stream of R parameter. When this function ...

Read More »

Java 8 Convert a List to Map Example

Hello readers, in this tutorial, we will learn how to convert a List<?> to a Map<K,V> using Java8 Streams API. 1. Introduction The most common task in Java programming is to convert a List of the object e.g. List<?> into a Map e.g. Map<K,V> where K is some property of the object and V is the real object. For e.g., ...

Read More »

Java 8 forEach Example

Hello readers, Java8 came up with a new feature to iterate over the Collection classes, by using the forEach() method of the Iterable interface or by using the new Stream class. In this tutorial, we will learn how to iterate over List, Set and Map using the Java forEach() method. 1. Introduction From Java 8 on, developers can iterate over ...

Read More »

Java 8 Convert an Array to List Example

Hello readers, in this tutorial, we will learn to convert the primitive array to list using the Java8 Stream API. 1. Introduction Converting an Array of data into an equivalent List does seem like one of the simplest tasks which a programmer would do when coding in Java. There are many scenarios where the data is present in an Array, ...

Read More »