In our programs we often have to deal with whitespaces, for example to sanitize input we received from users or other applications. With the release of Java 11, there have been some changes to the way whitespace is handled, and it’s important for developers to understand these changes in order to avoid potential pitfalls and write efficient, error-free code. In this blog post, we’ll take a closer look at whitespace in Java and provide some tips and best practices for working with whitespa...| TheJavaGuy Blog 🚀
Usage of artifical intelligence (AI) and large language models (LLM) to write code, comments, documentation etc. is the hottest topic for months now. Most of that attention is directed to the ChatGPT but by no means it’s the only game in town. Today I want to explore Character.AI and contrast it to the previous article in which I explored how ChatGPT writes Java code. Character.AI is actually a bunch of differently adjusted models which are known as characters (hence the name) that are clai...| TheJavaGuy Blog 🚀
Are you ready to level up your productivity? In this blog post, we’ll explore ChatGPT, a powerful and user-friendly language model that can generate Java functions and classes from textual descriptions thus helping you take your Java development to the next level. Read on to learn more!| TheJavaGuy Blog 🚀
When hearing the words “type inference”, most developers probably think of local-variable type inference that arrived in Java 10. But type inference in Java is much older than that. Some sort of it existed even in Java 6, where compilers could infer type parameters of generic constructors! For sure the most famous type inference example is the diamond operator in Java 7. Since the beginning, mere reduction of number of characters used in source code went hand in hand with type inference. ...| TheJavaGuy Blog 🚀
Manipulating a group of objects is something every Java developer does almost every day. In those situations, a lot of developers turn to some concrete collections such as ArrayList or HashSet without second thought. More experienced ones try to avoid accepting concrete classes and use some interface like java.util.List, and even more experienced ones turn to java.util.Collection. But sometimes we don’t need a collection at all, only the ability to iterate over some objects and for those ne...| TheJavaGuy Blog 🚀
Java 19 is currently the latest version of Java. Even though it isn’t a LTS release, it’s worth installing it so we can test new features. In one of the previous articles I have written about how to install it on MacOS. In this article I will show you how to install JDK 19 on Windows, add it to the path and to setup IntelliJ IDEA so you can write Java applications against it.| TheJavaGuy Blog 🚀
String manipulation is one of the most fundamental tasks of every developer. We create strings, read them, cut them, join them, pad them and generally do dozens of different processing activities on them. One of the most common of those is sorting. On the first glance, sorting looks like an easy and long solved problem… if you’re only dealing with 26 letters of an english alphabet that is. For almost any real-world application, sorting is filled with gotchas and intricacies. In this ultim...| TheJavaGuy Blog 🚀
We’ve heard it a thousand times already. “Use the right tool for the job”. It’s a very popular phrase between developers. Just look at the number of times it has been mentioned on HackerNews. Or search the internet and see enormous number of articles that DuckDuckGo or Ecosia or any other search engine have on the topic. While it sounds nice and useful, let’s first see some issues with this saying, and also what I recommend you to do when feeling paralyzed by the multitude of tools ...| TheJavaGuy Blog 🚀
I admit publicly that I like doing code reviews. Code that is submitted for review often contains a lot of implicit information and assumptions of a fellow developer that authored it. Going into their thought process sometimes reveals what we’ll see more and more often in software development - a forgotten knowledge about some topic and a way of working that is driven by inertia. “Now wait a second Ivan,” I hear you say, “what in the world does that have to do with prefixing names of ...| TheJavaGuy Blog 🚀
Java 18 is currently the latest version of Java. Even though it isn’t a LTS release, it’s worth installing it so we can test new features. In one of the previous articles I have written about how to install it on MacOS. In this article I will show you how to install JDK 18 on Windows, add it to the path and to setup IntelliJ IDEA so you can write Java applications against it.| TheJavaGuy Blog 🚀
When I had heard that finalization is (finally!) marked for removal, I was really happy. Some time in the future it will be gone for good from the JDK, which means less code, higher reliability, tighter security and a tad more performance. Marking something for removal from JDK is an extremely rare event. After all, source compatibility is one of the strongest Java’s points - you can just grab some source code from version X and it’s a really big surprise if it doesn’t compile in verson...| TheJavaGuy Blog 🚀
My son is 7½ years old and goes into second grade. We are not native English speakers – as the matter of fact, English is only his third language after Serbian and German. He knows maybe 100 English words, yet he managed to learn and deliberately apply 4 bash commands after just 1 hour of “studying” with me! I wanted to share this story to demonstrate what kids can effortlessly do if we give them just a bit of nudge, even in this time of flashy apps and games. I will reconstruct our ...| TheJavaGuy Blog 🚀
Ah, good old charsets, who doesn’t like them! With so many variations in operating systems, programming languages, human languages, geographical locations etc. what could possibly go wrong when we try to read from or write to files, sockets, screens and other input-output devices? It turns out, quite a lot. There’s no shortage of developer horror stories caused by wrong or improper encoding of data. While Java 18 doesn’t promise a silver bullet, it makes a step in the right direction be...| TheJavaGuy Blog 🚀
A lot of developers work on writing or debugging web applications daily. Sometimes that work involves writing our application’s backend and sometimes consuming other web resources, whether they are APIs or “normal” web pages. Other programming languages recognised the need for having a “quick and dirty” way of serving resources over HTTP(S) protocol during the development. Good people that developed JDK 18 gave us the opportunity to have that in Java too so we don’t have to look a...| TheJavaGuy Blog 🚀
How senior developers manage multiple JDKs with jEnv| TheJavaGuy Blog 🚀
Write better Javadoc using code snippets (part 2)| TheJavaGuy Blog 🚀
The easiest way to install Java 19 (OpenJDK 19) on MacOS| TheJavaGuy Blog 🚀
Use Simple Web Server programmatically like a real senior developer| TheJavaGuy Blog 🚀
Write better Javadoc using code snippets (part 1)| TheJavaGuy Blog 🚀
The easiest way to install Java 18 (OpenJDK 18) on MacOS| TheJavaGuy Blog 🚀