com.spun.util.ComparableUtils Maven / Gradle / Ivy
package com.spun.util;
public class ComparableUtils
{
public static > boolean isAEqualToB(T a, T b)
{
return a.compareTo(b) == 0;
}
public static > boolean isALessThanOrEqualToB(T a, T b)
{
return a.compareTo(b) <= 0;
}
public static > boolean isALessThanB(T a, T b)
{
return a.compareTo(b) < 0;
}
public static > ComparableWrapper wrap(T object)
{
return new ComparableWrapper<>(object);
}
public static class ComparableWrapper>
{
private final T object;
public ComparableWrapper(T object)
{
this.object = object;
}
public boolean isLessThan(T other)
{
return isALessThanB(object, other);
}
public boolean isEqualTo(T other)
{
return isAEqualToB(object, other);
}
public boolean isLessThanOrEqual(T other)
{
return isALessThanOrEqualToB(object, other);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy