Java – How to join List String with commas
In Java, we can use String.join(",", list) to join a List String with commas. We also can use Stream Collectors.joining or even in old days we create a custom method…
Favourite tutorials for developers
Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let programmers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need to recompile.
In Java, we can use String.join(",", list) to join a List String with commas. We also can use Stream Collectors.joining or even in old days we create a custom method…
Jackson provide writeValue() and readValue() methods to convert Java objects to / from JSON. mapper.writeValue – Java Objects to JSON. mapper.readValue – JSON to Java Objects.
In this tutorial, we will show you how to use Jackson 2.x to convert Java objects to / from a JSON: writeValue(...) – Java Objects to JSON , readValue(...) –…
In Java 8, the Stream.reduce() combine elements of a stream and produces a single value, with 2 arguments: 1 - identity is default or initial value, and 2 - BinaryOperator…
In this article, we will show you how to use Java 8 Stream Collectors to group by, count, sum and sort a List, and also do a mapping.
In this article, we will show you a few ways to print a Java Array. We can use JDK 1.5 Arrays.toString to print a simple array and Arrays.deepToString for 2d…
In this article, we will show you a few ways to join a Java Array: 1 - Apache Commons Lang – ArrayUtils, 2 - Java API, 3 - Java 8…
This article explains the Java 8 Stream.flatMap and how to use it. In Java 8, we can use the flatMap to convert the above 2 levels Stream into one Stream…
Few Java examples to show you how to filter a Map with Java 8 stream API. With Java 8, you can convert a Map.entrySet() into a stream, follow by a…
In Java 8, stream().map() lets you convert an object to something else. Review the following examples : convert a list of Strings to upper case, get all the name values…