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.
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.
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.
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 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 is an… Read More »How to Use Pattern Matching for instanceof From JDK16
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 »How to Map and Reduce Items From a List 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.
Usually, Java developers instantiate Maps using HashMap as implementation. Did you know HashMap doesn’t keep the order of insertion? Look at the following example: If we run the example above, the following output will be printed: So, if you want to keep the elements in… Read More »How to Keep the Elements of a Map in the Same Order That They Were Inserted
Here’s how to find the maximum value from a Collection in Java. If you have any questions, leave a comment or ask me on my social media.
Here’s how to split Strings in Java. If you have any questions, leave a comment or ask me on my social media.
Here’s how to join Strings in Java. If you have any questions, leave a comment or ask me on my social media.