👩💻 Join our community of thousands of amazing developers!
Java of() static factory method idiom The use of of() static factory methods to instantiate types has become a common idiom both within the JDK and third party libraries. Static factory methods have been around since the earliest days of Java, but back then the idiom was to name these methods valueOf, for example: String.valueOf(Object) Integer.valueOf(int) Over time a preference has developed for using the slightly terser of() form. EnumSet was one of the first types (introduced in JDK 1.5) t...