java.util.Collections
имеет несколько методов unmodifiable
, которые предоставляют немодифицируемые представления коллекции, обертывая коллекции в декораторах, которые запрещают операции мутации.
Java 6 добавила поддержку java.util.NavigableSet
и java.util.NavigableMap
.
Я хотел бы иметь unmodifiable NavigableSet
и NavigableMap
s, но java.util.Collections#unmodifiableSortedSet(SortedSet)
и java.util.Collections#unmodifiableSortedMap(SortedMap)
недостаточны, потому что они не поддерживают операции, которые являются особыми для NavigableSet
и NavigableMap
.
Существуют ли де-факто реализации для unmodifiableNavigableSet
и unmodifiableNavigableMap
?