Blog

Page 485 of my articles, tutorials, and thoughts

Latest Articles

Cover Image for Simple way to repeat a string
javastring

Simple way to repeat a string

Published on September 2, 2023

# Simple Way to Repeat a String: Skip the For Loop and Stay Clever! šŸ”„šŸ“ Are you tired of using for loops to repeat a string? Looking for a smarter and more direct method? Well, you've come to the right place! In this blog post, we'll explore a simple yet

Cover Image for How to get the last value of an ArrayList
arraylistjava

How to get the last value of an ArrayList

Published on September 2, 2023

# How to Get the Last Value of an ArrayList šŸ˜ŽšŸ’” Are you tired of searching for a simple and effective way to retrieve the last value of an ArrayList? šŸ”„šŸ’­ Look no further! In this blog post, we will explore the common issues and provide easy solutions to

Cover Image for Why does array[idx++]+="a" increase idx once in Java 8 but twice in Java 9 and 10?
javajava-10java-8java-9

Why does array[idx++]+="a" increase idx once in Java 8 but twice in Java 9 and 10?

Published on September 2, 2023

# Why does array[idx++]+="a" increase idx once in Java 8 but twice in Java 9 and 10? šŸ” Have you ever come across code that works differently in different versions of Java? In this blog post, we'll explore the mysterious behavior of the `+=` operator on

Cover Image for How do I convert from int to String?
javastringtype-conversion

How do I convert from int to String?

Published on September 2, 2023

# Converting from int to String: Breaking Down the Mysterious "+" Operator 🧐 So, you find yourself amidst a confusing project, scratching your head as you encounter this peculiar way of converting an `int` to a `String` in Java: ```java int i = 5; Strin

Cover Image for How to update a value, given a key in a hashmap?
hashmapjava

How to update a value, given a key in a hashmap?

Published on September 2, 2023

šŸ’” **Updating a Value in a Hashmap: Easy Solutions and Common Issues** **Introduction** Welcome to my blog! In today's post, we'll discuss a common question: how to update a value in a hashmap given a key. We'll explore easy solutions to this problem and

Cover Image for What is the difference between @Inject and @Autowired in Spring Framework? Which one to use under what condition?
dependency-injectionjavaspring

What is the difference between @Inject and @Autowired in Spring Framework? Which one to use under what condition?

Published on September 2, 2023

# Understanding the Difference between @Inject and @Autowired in Spring Framework Are you diving into the world of Spring Framework and find yourself confused between the usage of `@Inject` and `@Autowired` annotations? šŸ¤” Don't worry, you're not alone! M

Cover Image for How to read all files in a folder from Java?
directoryfileiojava

How to read all files in a folder from Java?

Published on September 2, 2023

šŸ“šŸ’»šŸ“‚ How to Read All Files in a Folder from Java: The Ultimate Guide! šŸ“šŸ’” Are you a Java developer trying to tackle the challenge of reading all the files in a folder, without worrying about the API? 🧐 Don't fret, we've got you covered! In this blog p

Cover Image for Converting ISO 8601-compliant String to java.util.Date
datejava

Converting ISO 8601-compliant String to java.util.Date

Published on September 2, 2023

# Converting ISO 8601-compliant String to java.util.Date: A Simple Solution ✨ Are you struggling to convert an ISO 8601 formatted string to a `java.util.Date` in your Java application? Don't worry, you're not alone! Many developers face this challenge, bu

Cover Image for What is the volatile keyword useful for?
javakeywordmultithreading

What is the volatile keyword useful for?

Published on September 2, 2023

šŸ”šŸ’„ Understanding the Volatile Keyword: Protecting Data in Java Have you ever encountered the mysterious "volatile" keyword in Java and wondered what it's all about? Today, I stumbled upon it at work and, like many developers, found myself scratching my

Cover Image for How to get the current time in YYYY-MM-DD HH:MI:Sec.Millisecond format in Java?
datejava

How to get the current time in YYYY-MM-DD HH:MI:Sec.Millisecond format in Java?

Published on September 2, 2023

# How to Get the Current Time in YYYY-MM-DD HH:MI:Sec.Millisecond Format in Java? šŸ•’ Have you ever wondered how to get the current time in Java but with milliseconds included? The code snippet you provided is a good start, but it's missing that extra prec