-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
6u24
-
x86
-
windows_2008
A DESCRIPTION OF THE REQUEST :
The contract for java.util.NavigableSet features two methods--pollFirst() and pollLast()--that are (a) destructive and (b) non-optional.
It is not clear from the contract of this interface whether these methods may throw UnsupportedOperationException. Please clarify the contract, ideally to permit implementations of these methods to throw UnsupportedOperationException in accordance with all the other destructive operations of Collection interfaces (add, remove, retainAll, clear, etc.)
JUSTIFICATION :
It is currently impossible to create a NavigableSet implementation that is immutable and still honors the NavigableSet contract as written.
The contract for java.util.NavigableSet features two methods--pollFirst() and pollLast()--that are (a) destructive and (b) non-optional.
It is not clear from the contract of this interface whether these methods may throw UnsupportedOperationException. Please clarify the contract, ideally to permit implementations of these methods to throw UnsupportedOperationException in accordance with all the other destructive operations of Collection interfaces (add, remove, retainAll, clear, etc.)
JUSTIFICATION :
It is currently impossible to create a NavigableSet implementation that is immutable and still honors the NavigableSet contract as written.
- duplicates
-
JDK-8159527 Collections mutator methods should all be marked as optional operations
- Resolved
- relates to
-
JDK-8159404 throw UnsupportedOperationException unconditionally for mutator methods
- Resolved