8159527: Collections mutator methods should all be marked as optional operations

Reviewed-by: naoto, bpb
This commit is contained in:
Stuart Marks 2023-08-04 19:27:56 +00:00
parent 873d117932
commit b2add96c35
5 changed files with 62 additions and 53 deletions

View file

@ -146,17 +146,23 @@ public interface NavigableSet<E> extends SortedSet<E> {
/**
* Retrieves and removes the first (lowest) element,
* or returns {@code null} if this set is empty.
* or returns {@code null} if this set is empty (optional operation).
*
* @return the first element, or {@code null} if this set is empty
*
* @throws UnsupportedOperationException if the {@code pollFirst}
* operation is not supported by this collection
*/
E pollFirst();
/**
* Retrieves and removes the last (highest) element,
* or returns {@code null} if this set is empty.
* or returns {@code null} if this set is empty (optional operation).
*
* @return the last element, or {@code null} if this set is empty
*
* @throws UnsupportedOperationException if the {@code pollLast}
* operation is not supported by this collection
*/
E pollLast();