List.unmodifiable(someList)
and Map.unmodifiable(someMap)
create an unmodifiable view, or a whole new independent list/map? I am guessing it's a new independent list, but I must be sure.
UnmodifiableListView<E>
Docs. But I still need to know the answer to the other questions.List.unmodifiable(someList)
? For example, this is the info for Java collections: Big O for Java Collections.UnmodifiableListView
UnmodifiableMapView
O(N)
– it copies all elements, so it has to visit each element.
List.unmodifiable
from another list, it knows the target length, so it won't have to resize the list it's creating as it's iterating.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With