Why does EnumSet have many overloaded “of” methods?
Varargs methods create an array. public static void foo(Object… args) { System.out.println(args.length); } This works, because of the implicit array creation. EnumSet is a class designed to be very, very fast, so by creating all the extra overloads they can skip the array creation step in the first few cases. This is especially true since … Read more