Package org.springframework.data.history
Class Revisions<N extends Number & Comparable<N>,T>
java.lang.Object
org.springframework.data.history.Revisions<N,T>
- All Implemented Interfaces:
Iterable<Revision<N,
,T>> Supplier<Stream<Revision<N,
,T>>> Streamable<Revision<N,
T>>
public class Revisions<N extends Number & Comparable<N>,T>
extends Object
implements Streamable<Revision<N,T>>
Simple wrapper class for a
List
of Revisions
allowing to canonically access the latest revision.
Allows iterating over the underlying Revisions
starting with older revisions.- Author:
- Oliver Gierke, Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptionReturns the content of theRevisions
instance.Returns the latest revision of the revisions backing the wrapper independently of the order.iterator()
static <N extends Number & Comparable<N>,
T>
Revisions<N,T> none()
Creates a new emptyRevisions
instance.static <N extends Number & Comparable<N>,
T>
Revisions<N,T> reverse()
Reverses the currentRevisions
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
of
public static <N extends Number & Comparable<N>,T> Revisions<N,T> of(List<? extends Revision<N, T>> revisions) - Returns:
- will never be null.
-
none
Creates a new emptyRevisions
instance.- Returns:
- will never be null.
-
getLatestRevision
Returns the latest revision of the revisions backing the wrapper independently of the order.- Returns:
-
reverse
Reverses the currentRevisions
. By default this will return the revisions with the latest revision first.- Returns:
-
iterator
-
getContent
Returns the content of theRevisions
instance.- Returns:
-