Java Code Examples for org.codehaus.groovy.runtime.ScriptBytecodeAdapter#compareGreaterThan()
The following examples show how to use
org.codehaus.groovy.runtime.ScriptBytecodeAdapter#compareGreaterThan() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ObjectRange.java From groovy with Apache License 2.0 | 5 votes |
private static boolean areReversed(Comparable from, Comparable to) { try { return ScriptBytecodeAdapter.compareGreaterThan(from, to); } catch (IllegalArgumentException iae) { throw new IllegalArgumentException("Unable to create range due to incompatible types: " + from.getClass().getSimpleName() + ".." + to.getClass().getSimpleName() + " (possible missing brackets around range?)", iae); } }
Example 2
Source File: GroovyCollections.java From groovy with Apache License 2.0 | 5 votes |
/** * Selects the maximum value found in an Iterable. * * @param items a Collection * @return the maximum value * @since 2.2.0 */ public static <T> T max(Iterable<T> items) { T answer = null; for (T value : items) { if (value != null) { if (answer == null || ScriptBytecodeAdapter.compareGreaterThan(value, answer)) { answer = value; } } } return answer; }