Unmodifiable NavigableSet/NavigableMap in Java?
Posted
by Greg Mattes
on Stack Overflow
See other posts from Stack Overflow
or by Greg Mattes
Published on 2010-04-05T09:35:08Z
Indexed on
2010/04/05
9:43 UTC
Read the original article
Hit count: 373
java
|collections
java.util.Collections has several unmodifiable methods that provide unmodifiable collection views by wrapping collections in decorators that prohibit mutation operations.
Java 6 added support for java.util.NavigableSet and java.util.NavigableMap.
I'd like to be able to have unmodifiable NavigableSets and NavigableMaps, but java.util.Collections#unmodifiableSortedSet(SortedSet) and java.util.Collections#unmodifiableSortedMap(SortedMap) are not sufficient because they do not support the operations that are particular to NavigableSet and NavigableMap.
Are there de-facto implementations for unmodifiableNavigableSet and unmodifiableNavigableMap?
© Stack Overflow or respective owner