code: public static boolean isSorted(State state, Comparator<Arc> comparator) {
      return Ordering.from(comparator).isOrdered(state.getArcs());
    }
docs: Returns true if the given state is sorted by the comparator
  @param state
  @param comparator
  @return