Class ElementOrder<T>
java.lang.Object
com.google.common.graph.ElementOrder<T>
Used to represent the order of elements in a data structure that supports different options for
iteration order guarantees.
Example usage:
MutableGraph<Integer> graph =
GraphBuilder.directed().nodeOrder(ElementOrder.<Integer>natural()).build();
- Since:
- 20.0
- Author:
- Joshua O'Madadhain
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The type of ordering that this object specifies. -
Method Summary
Modifier and TypeMethodDescriptionReturns theComparator
used.boolean
int
hashCode()
static <S> ElementOrder
<S> Returns an instance which specifies that insertion ordering is guaranteed.static <S extends Comparable<? super S>>
ElementOrder<S> natural()
Returns an instance which specifies that the natural ordering of the elements is guaranteed.static <S> ElementOrder
<S> sorted
(Comparator<S> comparator) Returns an instance which specifies that the ordering of the elements is guaranteed to be determined bycomparator
.static <S> ElementOrder
<S> stable()
Returns an instance which specifies that ordering is guaranteed to be always be the same across iterations, and across releases.toString()
type()
Returns the type of ordering used.static <S> ElementOrder
<S> Returns an instance which specifies that no ordering is guaranteed.
-
Method Details
-
unordered
Returns an instance which specifies that no ordering is guaranteed. -
stable
Returns an instance which specifies that ordering is guaranteed to be always be the same across iterations, and across releases. Some methods may have stronger guarantees.This instance is only useful in combination with
incidentEdgeOrder
, e.g.graphBuilder.incidentEdgeOrder(ElementOrder.stable())
.In combination with
incidentEdgeOrder
incidentEdgeOrder(ElementOrder.stable())
guarantees the ordering of the returned collections of the following methods:- For
Graph
andValueGraph
:edges()
: Stable orderadjacentNodes(node)
: Connecting edge insertion orderpredecessors(node)
: Connecting edge insertion ordersuccessors(node)
: Connecting edge insertion orderincidentEdges(node)
: Edge insertion order
- For
Network
:adjacentNodes(node)
: Stable orderpredecessors(node)
: Connecting edge insertion ordersuccessors(node)
: Connecting edge insertion orderincidentEdges(node)
: Stable orderinEdges(node)
: Edge insertion orderoutEdges(node)
: Edge insertion orderadjacentEdges(edge)
: Stable orderedgesConnecting(nodeU, nodeV)
: Edge insertion order
- Since:
- 29.0
- For
-
insertion
Returns an instance which specifies that insertion ordering is guaranteed. -
natural
Returns an instance which specifies that the natural ordering of the elements is guaranteed. -
sorted
Returns an instance which specifies that the ordering of the elements is guaranteed to be determined bycomparator
. -
type
Returns the type of ordering used. -
comparator
Returns theComparator
used.- Throws:
UnsupportedOperationException
- if comparator is not defined
-
equals
-
hashCode
-
toString
-