Closed nnym closed 3 years ago
Yeah, those were created when varargs did not exist...
In any case, 8.5.0 introduces .of() factory methods that make such changes not so necessary.
In any case I converted the few constructors for sets where varargs where possible. This cover cases in which .of() is not available, such as new RBTreeSet
Er, I had to roll back. There's a catch. For all integer types, there's a constructor with a single argument that is the size of the initial backing array. Having varargs creates a complete mess as depending on the number of arguments you get the empty set with a certain size or the set with the given elements. Let's stick to .of()...
Having varargs parameters instead of trailing array parameters in such list and set constructors could reduce verbosity when constructing them with a hardcoded collection of elements.