-
Type:
Enhancement
-
Resolution: Fixed
-
Priority:
P4
-
Affects Version/s: None
-
Component/s: core-libs
For non ImmutableCollections.AbstractImmutableSets the current copyOf-method allocates both a HashSet and subsequently an empty array when the input collection is empty.
A check for isEmpty and returning the empty immutable Set should be just fine and avoid needless allocations.
A check for isEmpty and returning the empty immutable Set should be just fine and avoid needless allocations.