All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.spun.util.ComparableUtils Maven / Gradle / Ivy

There is a newer version: 24.9.0
Show newest version
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