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
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!