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
A collection that is both a
SequencedCollection and aSet. As such, it can be thought of either as aSet that also has a well-definedencounter order, or as aSequencedCollection that also has unique elements. This interface has the same requirements on theequals andhashCode methods as defined bySet.equals andSet.hashCode. Thus, aSet and aSequencedSet will compare equals if and only if they have equal elements, irrespective of ordering.
SequencedSet defines thereversed() method, which provides a reverse-orderedview of this set. The only difference from theSequencedCollection.reversed method is that the return type ofSequencedSet.reversed isSequencedSet.
This class is a member of the Java Collections Framework.
- Since:
- 21
Method Summary
Methods declared in interface java.util.Collection
parallelStream,removeIf,stream,toArrayMethods declared in interface java.util.SequencedCollection
addFirst,addLast,getFirst,getLast,removeFirst,removeLast
Method Details
reversed
SequencedSet<E> reversed()Returns a reverse-orderedview of this collection. The encounter order of elements in the returned view is the inverse of the encounter order of elements in this collection. The reverse ordering affects all order-sensitive operations, including those on the view collections of the returned view. If the collection implementation permits modifications to this view, the modifications "write through" to the underlying collection. Changes to the underlying collection might or might not be visible in this reversed view, depending upon the implementation.- Specified by:
reversedin interfaceSequencedCollection<E>- Returns:
- a reverse-ordered view of this collection, as a
SequencedSet