Class ElementOrder<T>


  • @Beta
    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
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ElementOrder.Type
      The type of ordering that this object specifies.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Comparator<T> comparator()
      Returns the Comparator used.
      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>>
      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 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.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • unordered

        public static <S> ElementOrder<S> unordered()
        Returns an instance which specifies that no ordering is guaranteed.
      • insertion

        public static <S> ElementOrder<S> insertion()
        Returns an instance which specifies that insertion ordering is guaranteed.
      • natural

        public 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.
      • sorted

        public 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.
      • comparator

        public java.util.Comparator<T> comparator()
        Returns the Comparator used.
        Throws:
        java.lang.UnsupportedOperationException - if comparator is not defined
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object