How to sort a Map in Java
Few Java examples to sort a Map by its keys or values: (1) Uses java.util.TreeMap, it will sort the Map by keys automatically, (2) Yet another java.util.TreeMap example, provide a…
Favourite tutorials for developers
Few Java examples to sort a Map by its keys or values: (1) Uses java.util.TreeMap, it will sort the Map by keys automatically, (2) Yet another java.util.TreeMap example, provide a…
Java 8 Stream examples to sort a Map, by keys or by values. Steps to sort a Map in Java 8: (1) Convert a Map into a Stream, (2) Sort…
A series of Java 8 up to date tips and examples, hope you like it. Java 11 reached General Availability on 25 September 2018, this is a Long Term Support…
In Java, you can use System.getProperties() to get all the system properties. Also by sorting, you can display all the system properties in Alphabetical order.
This article shows a handy Java class that uses System.getProperty("os.name") to detect which type of operating system (OS) you are using now. This code can detect Windows, Mac, Unix, and…
In Java, we can use System.getProperty("user.dir") to get the current working directory, the directory from where your program was launched. The article shows different ways like File, Paths, FileSystems, or…
In this tutorial, we will show you three Java examples to construct a file path : (1) File.separator or System.getProperty(“file.separator”) (Recommended), (2) File file = new File(workingDir, filename); (Recommended), (3)…
In Java, the InputStreamReader accepts a charset to decode the byte streams into character streams. We can pass a StandardCharsets.UTF_8 into the InputStreamReader constructor to read data from a UTF-8…
In Java, the OutputStreamWriter accepts a charset to encode the character streams into byte streams. We can pass a StandardCharsets.UTF_8 into the OutputStreamWriter constructor to write data to a UTF-8…
In Java, you can use InetAddress.getLocalHost() to get the Ip Address of the current Server running the Java app.