United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6907251 : (coll) Add wrapper methods to Collections for NavigableSet and NavigableMap

Details
Type:
Enhancement
Submit Date:
2009-12-04
Status:
Resolved
Updated Date:
2013-07-18
Project Name:
JDK
Resolved Date:
2013-07-18
Component:
core-libs
OS:
windows_xp,windows_7
Sub-Component:
java.util:collections
CPU:
x86
Priority:
P5
Resolution:
Duplicate
Affected Versions:
7
Fixed Versions:
8

Related Reports
Duplicate:
Relates:
Relates:

Sub Tasks

Description
A DESCRIPTION OF THE REQUEST :
There are no wrapper methods in java.util.Collections for NavigableSet or NavigableMap.  Please consider adding the following:
checkedNavigableSet
checkedNavigableMap
synchronizedNavigableSet
synchronizedNavigableMap
unmodifiableNavigableSet
unmodifiableNavigableMap


JUSTIFICATION :
NavigableSet and NavigableMap provide highly useful enhancements to SortedSet and SortedMap.  Returning unmodifiable forms of them is often a cheap way to provide encapsulation of internal data kept in a NavigableSet or NavigableMap, especially data of immutable objects.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would like the java.util.Collections class to have wrapper methods for NavigableSet and NavigableMap.
ACTUAL -
Currently, there are no wrapper methods for NavigableSet and NavigableMap.

CUSTOMER SUBMITTED WORKAROUND :
1. Use SortedSet and SortedMap, if the reduced functionality is acceptable.
2.Write the wrappers oneself (which isn't as easy as it sounds, since all the returned Map.Entrys, collection views and descending views also need to be checked/unmodifiable).
3. Use defensive copying instead of unmodifiable wrappers;  use manual synchronization instead of synchronized wrappers.

                                    

Comments



Hardware and Software, Engineered to Work Together