Selects the minimum value found from the Iterator using the given comparator.

@param self       an Iterator
@param comparator a Comparator
@return the minimum value
@see #min(java.util.Collection, java.util.Comparator)
@since 1.5.5
199192
public static <T> T min(Iterator<T> self, Comparator<T> comparator) {
        return min((Iterable<T>)toList(self), comparator);
    }
750928
public static <T extends Comparable<? super T>> Iterator<T> getSortedIterator (Iterator<T> itr)
    {
        return getSortedIterator(itr, new Comparator<T>() {
            public int compare (T o1, T o2) {
                if (o1 == o2) { // catches null == null
                    return 0;
                } else if (o1 == null) {
                    return 1;
                } else if (o2 == null) {
                    return -1;
                }
                return o1.compareTo(o2); // null-free
            }
        });
    }
21615
public static Iterator<TableColumn> iterator(final TableColumnModel self) {
        return new Iterator<TableColumn>() {
            private int index = 0;

            public boolean hasNext() {
                return index > -1 && index < self.getColumnCount();
            }

            public TableColumn next() {
                return self.getColumn(index++);
            }

            public void remove() {
                if (hasNext()) self.removeColumn(self.getColumn(index--));
            }
        };
    }
740627
public static <T> Collector<T, ?, Seq<T>> maxAll(Comparator<? super T> comparator) {
        return maxAllBy(t -> t, comparator);
    }
1216477
public static <T> Iterator<T> reverse(Iterator<T> self) {
        return new ReverseListIterator<T>(toList(self));
    }
629967
@SuppressWarnings("unchecked")
    public static Iterator<TreeNode> iterator(TreeNode self) {
        return (Iterator<TreeNode>) DefaultGroovyMethods.iterator(self.children());
    }
470306
public static <T> int compare(T o1, T o2, Comparator<T> comparator) {
		if(o1 == null) {
			return o2 == null ? 0 : 1;
		} else if(o2 == null) {
			return -1;
		} else {
			return comparator.compare(o1, o2);
		}
	}
128906
public static Iterator iterator(final MutableComboBoxModel self) {
        return new Iterator() {
            private int index = 0;

            public boolean hasNext() {
                return index > -1 && index < self.getSize();
            }

            public Object next() {
                return self.getElementAt(index++);
            }

            public void remove() {
                if (hasNext()) self.removeElementAt(index--);
            }
        };
    }
1079788
public static int numberAwareCompareTo(Comparable self, Comparable other) {
        NumberAwareComparator<Comparable> numberAwareComparator = new NumberAwareComparator<Comparable>();
        return numberAwareComparator.compare(self, other);
    }
869305
public static <T> Comparator<T> comparator(CheckedComparator<T> comparator, Consumer<Throwable> handler) {
        return (t1, t2) -> {
            try {
                return comparator.compare(t1, t2);
            }
            catch (Throwable e) {
                handler.accept(e);

                throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
            }
        };
    }
352993
public static <T> Comparator<T> comparator(CheckedComparator<T> comparator) {
        return Unchecked.comparator(comparator, Unchecked.RETHROW_ALL);
    }
623436
function min(keySelector, comparer) {
  let itComparer = typeof comparer === 'function' ? comparer : util.defaultComparer;
  let itKeySelector = typeof keySelector === 'function' ? keySelector : (i) => i;

  let minimum = this.firstOrDefault();

  for (let item of this) {
    minimum = itComparer(itKeySelector(item), itKeySelector(minimum)) < 0 ? item : minimum;
  }

  return minimum;
}
121760
public static ComparatorItem fromSort(Sort sort) {
    if (sort == null) {
      return null;
    }
    ComparatorItem comparatorItem = null;
    for (Order order : sort) {
      ComparatorItem item = fromSortOrder(order);
      if (item != null) {
        if (comparatorItem == null) {
          comparatorItem = item;
        } else {
          comparatorItem.getLastComparatorItem().setNextComparatorItem(item);
        }
      }
    }
    return comparatorItem;
  }
806477
public static <T> Collector<T, ?, Optional<T>> min(Comparator<? super T> comparator) {
        return minBy(t -> t, comparator);
    }
1045353
public static Iterator<Byte> iterator(final DataInputStream self) {
        return new Iterator<Byte>() {
            Byte nextVal;
            boolean nextMustRead = true;
            boolean hasNext = true;

            public boolean hasNext() {
                if (nextMustRead && hasNext) {
                    try {
                        nextVal = self.readByte();
                        nextMustRead = false;
                    } catch (IOException e) {
                        hasNext = false;
                    }
                }
                return hasNext;
            }

            public Byte next() {
                Byte retval = null;
                if (nextMustRead) {
                    try {
                        retval = self.readByte();
                    } catch (IOException e) {
                        hasNext = false;
                    }
                } else
                    retval = nextVal;
                nextMustRead = true;
                return retval;
            }

            public void remove() {
                throw new UnsupportedOperationException("Cannot remove() from a DataInputStream Iterator");
            }
        };
    }
537558
public void sortReverse(final Comparator<T> comparator) {
    this.sort(comparator);
    for (int i = 0; i < this.size / 2; i++) {
      final T temp = this.elements[i];
      this.elements[i] = this.elements[this.size - i - 1];
      this.elements[this.size - i - 1] = temp;
    }
  }
1365508
public Comparator<Integer> comparator() {
        return new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                Http2PriorityNode n1 = nodesByID.get(o1);
                Http2PriorityNode n2 = nodesByID.get(o2);
                if(n1 == null && n2 == null) {
                    return 0;
                }
                if(n1 == null) {
                    return -1;
                }
                if(n2 == null) {
                    return 1;
                }
                //do the comparison
                //this is kinda crap, but I can't really think of any better way to handle this

                double d1 = createWeightingProportion(n1);
                double d2 = createWeightingProportion(n2);
                return Double.compare(d1, d2);
            }
        };
    }