Interface SequencedSet<E>
- Type Parameters:
E- the type of elements in this sequenced set
- All Superinterfaces:
Collection<E>, Iterable<E>, SequencedCollection<E>, Set<E>
- All Known Subinterfaces:
NavigableSet<E>, SortedSet<E>
- All Known Implementing Classes:
ConcurrentSkipListSet, LinkedHashSet, TreeSet
public interface SequencedSet<E> extends SequencedCollection<E>, Set<E>
SequencedCollection and a Set. As such, it can be thought of either as a Set that also has a well-defined encounter order, or as a SequencedCollection that also has unique elements. This interface has the same requirements on the equals and hashCode methods as defined by Set.equals and Set.hashCode. Thus, a Set and a SequencedSet will compare equals if and only if they have equal elements, irrespective of ordering.
SequencedSet defines the reversed() method, which provides a reverse-ordered view of this set. The only difference from the SequencedCollection.reversed method is that the return type of SequencedSet.reversed is SequencedSet.
This class is a member of the Java Collections Framework.
- Since:
- 21
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
SequencedSet |
reversed() |
Returns a reverse-ordered view of this collection. |
Methods declared in interface Collection
parallelStream, removeIf, stream, toArray | Modifier and Type | Method | Description |
|---|---|---|
default Stream |
parallelStream() |
Returns a possibly parallel Stream with this collection as its source. |
default boolean |
removeIf |
Removes all of the elements of this collection that satisfy the given predicate (optional operation). |
default Stream |
stream() |
Returns a sequential Stream with this collection as its source. |
default <T> T[] |
toArray |
Returns an array containing all of the elements in this collection, using the provided generator function to allocate the returned array. |
Methods declared in interface Iterable
forEach | Modifier and Type | Method | Description |
|---|---|---|
default void |
forEach |
Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception. |
Methods declared in interface SequencedCollection
addFirst, addLast, getFirst, getLast, removeFirst, removeLast | Modifier and Type | Method | Description |
|---|---|---|
default void |
addFirst |
Adds an element as the first element of this collection (optional operation). |
default void |
addLast |
Adds an element as the last element of this collection (optional operation). |
default E |
getFirst() |
Gets the first element of this collection. |
default E |
getLast() |
Gets the last element of this collection. |
default E |
removeFirst() |
Removes and returns the first element of this collection (optional operation). |
default E |
removeLast() |
Removes and returns the last element of this collection (optional operation). |
Methods declared in interface Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, spliterator, toArray, toArray | Modifier and Type | Method | Description |
|---|---|---|
boolean |
add |
Adds the specified element to this set if it is not already present (optional operation). |
boolean |
addAll |
Adds all of the elements in the specified collection to this set if they're not already present (optional operation). |
void |
clear() |
Removes all of the elements from this set (optional operation). |
boolean |
contains |
Returns true if this set contains the specified element. |
boolean |
containsAll |
Returns true if this set contains all of the elements of the specified collection. |
boolean |
equals |
Compares the specified object with this set for equality. |
int |
hashCode() |
Returns the hash code value for this set. |
boolean |
isEmpty() |
Returns true if this set contains no elements. |
Iterator |
iterator() |
Returns an iterator over the elements in this set. |
boolean |
remove |
Removes the specified element from this set if it is present (optional operation). |
boolean |
removeAll |
Removes from this set all of its elements that are contained in the specified collection (optional operation). |
boolean |
retainAll |
Retains only the elements in this set that are contained in the specified collection (optional operation). |
int |
size() |
Returns the number of elements in this set (its cardinality). |
default Spliterator |
spliterator() |
Creates a Spliterator over the elements in this set. |
Object[] |
toArray() |
Returns an array containing all of the elements in this set. |
<T> T[] |
toArray |
Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array. |
Method Details
reversed
SequencedSet<E> reversed()
- Specified by:
-
reversedin interfaceSequencedCollection<E> - Returns:
- a reverse-ordered view of this collection, as a
SequencedSet
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.