How to Sort a List by a Specific Attribute in Java

Here’s how to sort a List by a specific attribute in Java: If you have any questions, leave a comment or send me a message on my social media. The post How to Sort a List by a Specific Attribute in Java appeared first on The Great API.

Read More
Mar 10, 2022
How to Create a String From a List: One Item per Line

Here’s how to create a String from a List in Java: one item per line: If you have any questions, leave a comment or send me a message on my social media. The post How to Create a String From a List: One Item per Line appeared first on The Great API.

Read More
Mar 06, 2022
How to Load Properties From a File in Java.

Here’s how to load properties from a file in Java. Given the following src/main/resources/config.properties file: The following code will output: {pool-size=42, active=true} If you have any questions, leave a comment or ask me on my social media. The...

Read More
Feb 21, 2022
Python vs. Java — What’s the Difference?

Python and Java are two very popular programming languages. Likely, most, if not all of today’s developers and programmers have encountered either one of the two. Although TechRepublic reports an increase in usage for Python in recent years, many dev...

Read More
Jan 18, 2022
Creating More Intuitive Java APIs With Optional

Creating intuitive APIs is a very important skill for you to reduce the chances of bugs and make your software more maintainable. When you don’t create intuitive APIs, your code becomes error prone and the developers (including you) may misuse an API...

Read More
Nov 04, 2021
How to Use Pattern Matching for instanceof From JDK16

The new LTS version (version 17) of Java was released in September. And since the previous LTS (version 11), many cool features were added. One of the coolest ones is “Pattern Matching for instanceof“. Until Java 15, when we checked whether an object...

Read More
Oct 14, 2021
How to Map and Reduce Items From a List in Java

Mapping items from a List means that each item from that List will be converted into another object. Reducing items from a List means that all items from that List will be combined into a single object, which doesn’t necessarily have the same type as...

Read More
Oct 07, 2021
How to Reverse a String in Java

If you need to reverse the character order of a String, you can use StringBuilder to do that. Note that the following code prints: Java is great! If you have any questions, leave a comment or send me a message on my social media. The post How to Reve...

Read More
Sep 29, 2021