
com.github.geekonjava.query.order.OrderComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Purify4J Show documentation
Show all versions of Purify4J Show documentation
Simple library for use to refine the Java Collection Objects
The newest version!
package com.github.geekonjava.query.order;
import java.util.Comparator;
import com.github.geekonjava.reflection.Phanton;
public class OrderComparator implements Comparator {
private final String method;
public OrderComparator(String method) {
this.method = method;
}
@Override
@SuppressWarnings("unchecked")
public int compare(T one, T other) {
Object oneValue = Phanton.from(one).call(method);
Object otherValue = Phanton.from(other).call(method);
if (oneValue == null || otherValue == null) {
return 0;
}
if (oneValue instanceof Comparable) {
return ((Comparable
© 2015 - 2025 Weber Informatics LLC | Privacy Policy