Frederick Winsnes wrote:I wonder why this is not a part of the official API.
Because Rob C wrote it himself
Gems like these rarely make it into the official API because in most cases, Oracle doesn't even know they exist. Sometimes they do though; I've written my own java.io.FileFilter implementation that looks for extensions, plus a generic java.io.FileFilter to javax.swing.filechooser.FileFilter bridge, long before Sun added FileNameExtensionFilter (not based on my classes by the way, the idea is just common). And don't forget about the upcoming
java.util.Objects class in
Java 7 that finally adds an equals utility method that can compare two objects references which may or may not be null. Oh, and those Objects.nonNull methods? I've had those methods for years already. (Again, it's not copied from my classes. They're not even public.)
But in general, a lot of useful code never makes it into the official API. Fortunately, it doesn't have to; you can simply download it and include it in your project, usually as JAR files.