Spring Framework NullSafeComparator - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework NullSafeComparator class.

This code example shows how to use the following methods:compare
	 */ 
	public boolean test(Object argument1, Object argument2) {
		if (getComparator() != null) 
			return testCompareResult(getComparator().compare(argument1, argument2));
 
        return testCompareResult(COMPARATOR.compare(argument1, argument2));
	} 
 
	/** 
	 * Template method for evaluating the compare result. 
	 * 
	 * @param result 
	 *            The compare result 
	 * @return true or false 
	 */ 
	protected abstract boolean testCompareResult(int result);
 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:compare
	 * @param comparable2 
	 *            the second comparable 
	 * @return the minimum 
	 */ 
	public Object call(Object comparable1, Object comparable2) {
		int result = COMPARATOR.compare(comparable1,
				comparable2);
		if (result < 0) {
			return comparable1;
		} 
		else if (result > 0) {
			return comparable2;
		} 
		return comparable1;
	} 
 
	public String toString() {
		return "min(arg1, arg2)"; 
	} 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 */ 
public class Maximum extends AbstractBinaryClosure { 
 
    private static final Maximum INSTANCE = new Maximum();
 
    private static final NullSafeComparator COMPARATOR = new NullSafeComparator(new ComparableComparator(), true);
 
	/** 
	 * Returns the shared instance--this is possible as the default functor for 
	 * this class is immutable and stateless. 
	 * 
	 * @return the shared instance 
	 */ 
	public static final BinaryClosure instance() { 
		return INSTANCE;
	} 
 
	/** 
	 * Return the maximum of the two Comparable objects. 
	 * 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java