Class TopologicalSort.InitialOrderComparator<T>

  • All Implemented Interfaces:
    java.util.Comparator<T>
    Enclosing class:
    TopologicalSort<T>

    private static class TopologicalSort.InitialOrderComparator<T>
    extends java.lang.Object
    implements java.util.Comparator<T>
    A comparator that is used to sort dependencies in the order they were in the original list. This ensures that dependencies are visited in the original order and no needless reordering takes place.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<T,​java.lang.Integer> _indexes  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(T o1, T o2)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Field Detail

      • _indexes

        private final java.util.Map<T,​java.lang.Integer> _indexes
    • Constructor Detail

      • InitialOrderComparator

        InitialOrderComparator​(T[] initial)
      • InitialOrderComparator

        InitialOrderComparator​(java.util.Collection<T> initial)
    • Method Detail

      • compare

        public int compare​(T o1,
                           T o2)
        Specified by:
        compare in interface java.util.Comparator<T>