1 import jdk.incubator.mvt.ValueCapableClass;
   2 
   3 @ValueCapableClass
   4 public final class Interval {
   5     public final int l;
   6     public final int u;
   7 
   8     public Interval(int l, int u) {
   9         if (l > u) throw new IllegalArgumentException();
  10         this.l = l;
  11         this.u = u;
  12     }
  13 
  14     @Override
  15     public boolean equals(Object o) {
  16         if (this == o) return true;
  17         if (o == null || getClass() != o.getClass()) return false;
  18 
  19         Interval that = (Interval) o;
  20 
  21         if (l != that.l) return false;
  22         return u == that.u;
  23     }
  24 
  25     @Override
  26     public int hashCode() {
  27         int result = l;
  28         result = 31 * result + u;
  29         return result;
  30     }
  31 }