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. But is that its biggest advantage?
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
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 needs,
Iterable is beautiful! Let’s see how to improve your programs by using
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.
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 this article I will show you how to install JDK 19 on MacOS and to setup IntelliJ IDEA so you can write Java applications against it.
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 ultimate guide to string sorting I’ll dive deeply and answer questions of sorting strings with numbers, in mixed upper case and lower case, with accented letters etc. Fasten your seatbelts!
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 that people preach are the right ones.
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 my tests with… test?”
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.
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 X+N. What is so bad about the finalization that it had to be marked for removal?