@Beta public final class ElementOrder<T> extends java.lang.Object
Example usage:
MutableGraph<Integer> graph =
GraphBuilder.directed().nodeOrder(ElementOrder.<Integer>natural()).build();
Modifier and Type | Class and Description |
---|---|
static class |
ElementOrder.Type
The type of ordering that this object specifies.
|
Modifier and Type | Field and Description |
---|---|
private java.util.Comparator<T> |
comparator |
private ElementOrder.Type |
type |
Modifier | Constructor and Description |
---|---|
private |
ElementOrder(ElementOrder.Type type,
java.util.Comparator<T> comparator) |
Modifier and Type | Method and Description |
---|---|
(package private) <T1 extends T> |
cast() |
java.util.Comparator<T> |
comparator()
Returns the
Comparator used. |
(package private) <K extends T,V> |
createMap(int expectedSize)
Returns an empty mutable map whose keys will respect this
ElementOrder . |
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
static <S> ElementOrder<S> |
insertion()
Returns an instance which specifies that insertion ordering is guaranteed.
|
static <S extends java.lang.Comparable<? super 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 by
comparator . |
java.lang.String |
toString() |
ElementOrder.Type |
type()
Returns the type of ordering used.
|
static <S> ElementOrder<S> |
unordered()
Returns an instance which specifies that no ordering is guaranteed.
|
private final ElementOrder.Type type
@Nullable private final java.util.Comparator<T> comparator
private ElementOrder(ElementOrder.Type type, @Nullable java.util.Comparator<T> comparator)
public static <S> ElementOrder<S> unordered()
public static <S> ElementOrder<S> insertion()
public static <S extends java.lang.Comparable<? super S>> ElementOrder<S> natural()
public static <S> ElementOrder<S> sorted(java.util.Comparator<S> comparator)
comparator
.public ElementOrder.Type type()
public java.util.Comparator<T> comparator()
Comparator
used.java.lang.UnsupportedOperationException
- if comparator is not definedpublic boolean equals(@Nullable java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
<K extends T,V> java.util.Map<K,V> createMap(int expectedSize)
ElementOrder
.<T1 extends T> ElementOrder<T1> cast()