/** * @deprecated Use the Iterable version of min instead * @see #min(Iterable, Closure) * @since 1.0 */ @Deprecated public static <T> T min(Collection<T> self, Closure closure) { return min((Iterable<T>)self, closure); }
/** * @deprecated Use the Iterable version of min instead * @see #min(Iterable, Comparator) * @since 1.0 */ @Deprecated public static <T> T min(Collection<T> self, Comparator<T> comparator) { return min((Iterable<T>) self, comparator); }
/** * Selects the minimum value found from the Object array using the given comparator. * * @param self an array * @param comparator a Comparator * @return the minimum value * @see #min(java.util.Collection, java.util.Comparator) * @since 1.5.5 */ public static <T> T min(T[] self, Comparator<T> comparator) { return min((Iterable<T>)toList(self), comparator); }
/** * Adds min() method to Object arrays. * * @param self an array * @return the minimum value * @see #min(java.util.Collection) * @since 1.5.5 */ public static <T> T min(T[] self) { return min((Iterable<T>)toList(self)); }
/** * Adds min() method to Iterator objects. The iterator will become * exhausted of elements after determining the minimum value. * * @param self an Iterator * @return the minimum value * @see #min(java.util.Collection) * @since 1.5.5 */ public static <T> T min(Iterator<T> self) { return min((Iterable<T>)toList(self)); }
/** * 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 */ public static <T> T min(Iterator<T> self, Comparator<T> comparator) { return min((Iterable<T>)toList(self), comparator); }
return min((Iterable<Map.Entry<K, V>>)self.entrySet(), closure);
/** * Selects the minimum value found from the Object array * using the closure to determine the correct ordering. * <p> * If the closure has two parameters * it is used like a traditional Comparator. I.e. it should compare * its two parameters for order, returning a negative integer, * zero, or a positive integer when the first parameter is less than, * equal to, or greater than the second respectively. Otherwise, * the Closure is assumed to take a single parameter and return a * Comparable (typically an Integer) which is then used for * further comparison. * * @param self an array * @param closure a Closure used to determine the correct ordering * @return the minimum value * @see #min(java.util.Collection, groovy.lang.Closure) * @since 1.5.5 */ public static <T> T min(T[] self, @ClosureParams(value=FromString.class, options={"T","T,T"}) Closure closure) { return min((Iterable<T>)toList(self), closure); }
/** * Selects the minimum value found from the Iterator * using the closure to determine the correct ordering. * The iterator will become * exhausted of elements after this operation. * <p> * If the closure has two parameters * it is used like a traditional Comparator. I.e. it should compare * its two parameters for order, returning a negative integer, * zero, or a positive integer when the first parameter is less than, * equal to, or greater than the second respectively. Otherwise, * the Closure is assumed to take a single parameter and return a * Comparable (typically an Integer) which is then used for * further comparison. * * @param self an Iterator * @param closure a Closure used to determine the correct ordering * @return the minimum value * @see #min(java.util.Collection, groovy.lang.Closure) * @since 1.5.5 */ public static <T> T min(Iterator<T> self, @ClosureParams(value=FromString.class, options={"T","T,T"}) Closure closure) { return min((Iterable<T>)toList(self), closure); }
int params = closure.getMaximumNumberOfParameters(); if (params != 1) { return min(self, new ClosureComparator<T>(closure));
/** * Adds min() method to Object arrays. * * @param self an Object array * @return the minimum value * @see #min(java.util.Collection) * @since 1.5.5 */ public static <T> T min(T[] self) { return min(toList(self)); }
/** * Adds min() method to Iterator objects. The iterator will become * exhausted of elements after determining the minimum value. * * @param self an Iterator * @return the minimum value * @see #min(java.util.Collection) */ public static Object min(Iterator self) { return min(toList(self)); }
/** * Adds min() method to Object arrays. * * @param self an Object array * @return the minimum value * @see #min(java.util.Collection) */ public static Object min(Object[] self) { return min(toList(self)); }
/** * Selects the minimum value found from the Object array using the given comparator. * * @param self an Object array * @param comparator a Comparator * @return the minimum value * @see #min(java.util.Collection, java.util.Comparator) * @since 1.5.5 */ public static <T> T min(T[] self, Comparator<T> comparator) { return min(toList(self), comparator); }
/** * Adds min() method to Iterator objects. The iterator will become * exhausted of elements after determining the minimum value. * * @param self an Iterator * @return the minimum value * @see #min(java.util.Collection) * @since 1.5.5 */ public static Object min(Iterator self) { return min(toList(self)); }
/** * 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) */ public static Object min(Iterator self, Comparator comparator) { return min(toList(self), comparator); }
/** * Adds min() method to Iterator objects. The iterator will become * exhausted of elements after determining the minimum value. * * @param self an Iterator * @return the minimum value * @see #min(java.util.Collection) * @since 1.5.5 */ public static <T> T min(Iterator<T> self) { return min(toList(self)); }
public static<T extends Object >T min(Iterable<T> self, Closure closure) { if ((!Caller.isAsynchronous(self, "min", closure))&&(!Caller.isAsynchronous(CpsDefaultGroovyMethods.class, "min", self, closure))) { return DefaultGroovyMethods.min(self, closure); } return CpsDefaultGroovyMethods.$min__java_lang_Iterable__groovy_lang_Closure(self, closure); }
public static<T extends Object >T min(T[] self, Closure closure) { if ((!Caller.isAsynchronous(self, "min", closure))&&(!Caller.isAsynchronous(CpsDefaultGroovyMethods.class, "min", self, closure))) { return DefaultGroovyMethods.min(self, closure); } return CpsDefaultGroovyMethods.$min__java_lang_Object_array__groovy_lang_Closure(self, closure); }
public static<T extends Object >T min(Iterator<T> self, Closure closure) { if ((!Caller.isAsynchronous(self, "min", closure))&&(!Caller.isAsynchronous(CpsDefaultGroovyMethods.class, "min", self, closure))) { return DefaultGroovyMethods.min(self, closure); } return CpsDefaultGroovyMethods.$min__java_util_Iterator__groovy_lang_Closure(self, closure); }