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.
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.
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 developers still swear by Java. To those who… Read More »Python vs. Java — What’s the Difference?
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. Let’s see an… Read More »Creating More Intuitive Java APIs With Optional
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
When you need to test an application that consumes a web API, you basically have two options: Use Testcontainers to start a container that will run the web API which your application will consume. Mock a Web Server to emulate the web API which your… Read More »How to Mock a Web Server Using WireMock in Your Java Applications
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.