List of usage examples for org.apache.commons.lang3 ObjectUtils compare
public static <T extends Comparable<? super T>> int compare(final T c1, final T c2, final boolean nullGreater)
Null safe comparison of Comparables.
From source file:org.bonitasoft.web.designer.model.asset.Asset.java
public static Comparator<Asset> getComparatorByComponentId() { return new Comparator<Asset>() { @Override//w ww . ja v a2 s. co m public int compare(Asset asset1, Asset asset2) { return ObjectUtils.compare(asset1.getComponentId(), asset2.getComponentId(), true); } }; }
From source file:org.broadleafcommerce.core.catalog.domain.ProductImpl.java
@Override public List<ProductOptionXref> getProductOptionXrefs() { List<ProductOptionXref> sorted = new ArrayList<ProductOptionXref>(productOptions); Collections.sort(sorted, new Comparator<ProductOptionXref>() { @Override// www . ja v a 2s. c om public int compare(ProductOptionXref o1, ProductOptionXref o2) { return ObjectUtils.compare(o1.getProductOption().getDisplayOrder(), o2.getProductOption().getDisplayOrder(), true); } }); return sorted; }
From source file:org.mitre.mpf.interop.JsonActionOutputObject.java
@Override public int compareTo(JsonActionOutputObject other) { int result = 0; if (other == null) { return 0; } else if ((result = ObjectUtils.compare(source, other.source, false)) != 0 || (result = Integer.compare(tracks.hashCode(), other.tracks.hashCode())) != 0) { return result; } else {//from w w w .j a v a 2s. c o m return 0; } }
From source file:org.mitre.mpf.interop.JsonTrackOutputObject.java
@Override public int compareTo(JsonTrackOutputObject other) { int result = 0; if (other == null) { return 0; } else if ((result = Integer.compare(startOffsetFrame, other.startOffsetFrame)) != 0 || (result = Integer.compare(stopOffsetFrame, other.stopOffsetFrame)) != 0 || (result = Integer.compare(startOffsetTime, other.startOffsetTime)) != 0 || (result = Integer.compare(stopOffsetTime, other.stopOffsetTime)) != 0 || (result = ObjectUtils.compare(type, other.type, false)) != 0 || (result = ObjectUtils.compare(source, other.source, false)) != 0 || (result = ObjectUtils.compare(id, other.id, false)) != 0) { return result; } else {// w ww. ja v a2 s . c o m return 0; } }