Package com.google.common.graph
Class ElementOrder<T>
- java.lang.Object
- 
- com.google.common.graph.ElementOrder<T>
 
- 
 @Beta @Immutable public final class ElementOrder<T> extends java.lang.Object 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 SummaryNested Classes Modifier and Type Class Description static classElementOrder.TypeThe type of ordering that this object specifies.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Comparator<T>comparator()Returns theComparatorused.booleanequals(java.lang.Object obj)inthashCode()static <S> ElementOrder<S>insertion()Returns an instance which specifies that insertion ordering is guaranteed.static <S extends java.lang.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(java.util.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.java.lang.StringtoString()ElementOrder.Typetype()Returns the type of ordering used.static <S> ElementOrder<S>unordered()Returns an instance which specifies that no ordering is guaranteed.
 
- 
- 
- 
Method Detail- 
unorderedpublic static <S> ElementOrder<S> unordered() Returns an instance which specifies that no ordering is guaranteed.
 - 
stablepublic 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. Some methods may have stronger guarantees.This instance is only useful in combination with incidentEdgeOrder, e.g.graphBuilder.incidentEdgeOrder(ElementOrder.stable()).In combination withincidentEdgeOrderincidentEdgeOrder(ElementOrder.stable())guarantees the ordering of the returned collections of the following methods:- For GraphandValueGraph:- edges(): Stable order
- adjacentNodes(node): Connecting edge insertion order
- predecessors(node): Connecting edge insertion order
- successors(node): Connecting edge insertion order
- incidentEdges(node): Edge insertion order
 
- For Network:- adjacentNodes(node): Stable order
- predecessors(node): Connecting edge insertion order
- successors(node): Connecting edge insertion order
- incidentEdges(node): Stable order
- inEdges(node): Edge insertion order
- outEdges(node): Edge insertion order
- adjacentEdges(edge): Stable order
- edgesConnecting(nodeU, nodeV): Edge insertion order
 
 - Since:
- 29.0
 
- For 
 - 
insertionpublic static <S> ElementOrder<S> insertion() Returns an instance which specifies that insertion ordering is guaranteed.
 - 
naturalpublic static <S extends java.lang.Comparable<? super S>> ElementOrder<S> natural() Returns an instance which specifies that the natural ordering of the elements is guaranteed.
 - 
sortedpublic static <S> ElementOrder<S> sorted(java.util.Comparator<S> comparator) Returns an instance which specifies that the ordering of the elements is guaranteed to be determined bycomparator.
 - 
typepublic ElementOrder.Type type() Returns the type of ordering used.
 - 
comparatorpublic java.util.Comparator<T> comparator() Returns theComparatorused.- Throws:
- java.lang.UnsupportedOperationException- if comparator is not defined
 
 - 
equalspublic boolean equals(@CheckForNull java.lang.Object obj) - Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-