Common Java Utility Methods Every Programmer Should Use Part 1

less than 1 minute read

This post will be the first in a series of posts describing useful utility methods that will help make any programmers day to day code implementation easier.

The methods in this post:

    String.format() java.io.FileFilter Collections.sort() parsePropertiesFromString()

String.format() This method is useful to build a string programmatically without using concatenation, it generally makes for more readable and therefore manageable code.

Collections.sort() A straight forward method call used to sort a collection based on its “natural order” - alphabetically for Strings, numerically for Integers.

java.io.FileFilter This class enables you to specify how you want to filter files that you add to a Collection.

CollectionStringUtils.parsePropertiesFromString() This handy method is from the impala framework: org.impalaframework, and allows you to create a Map of key value pairs from a String object.

Updated: