eclipse-collections
eclipse-collections copied to clipboard
`nCopies` variation of `ImmutableList`
It is sometimes useful to have a memory-efficient list comprising a fixed number of copies of a given input. I would propose two variants: one which returns n
copies of a single item (similar to java.util.Collections#nCopies
; additionally, if n
is 0
then the empty list is returned), and one which returns n
copies of an inner ImmutableList
(if the inner list is empty, then the empty list can be used since n × 0 = 0
).