com.maxifier.mxcache.jconsoleplugin.ComparableComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mxcache-jmx Show documentation
Show all versions of mxcache-jmx Show documentation
MxCache management extensions and JConsole plugin
/*
* Copyright (c) 2008-2014 Maxifier Ltd. All Rights Reserved.
*/
package com.maxifier.mxcache.jconsoleplugin;
import java.io.Serializable;
import java.util.Comparator;
/**
* @author Alexander Kochurov ([email protected])
*/
public class ComparableComparator implements Comparator, Serializable {
private static final long serialVersionUID = 1L;
@SuppressWarnings({ "unchecked" })
@Override
public int compare(Comparable o1, Comparable o2) {
if (o1 == null) {
return o2 == null ? -1 : 0;
}
if (o2 == null) {
return 1;
}
return o1.compareTo(o2);
}
}