Code example for DiscreteDomain

Methods: nextprevious

0
  Range<T> adjustClosed(Range<T> range, DiscreteDomain<T> domain) {
    // adjust to a closed range to avoid catching extra keys 
    if (range.hasLowerBound()) { 
      T lower = range.lowerEndpoint();
      if (range.isLowerBoundOpen()) { 
        lower = domain.next(lower);
      } 
      if (range.hasUpperBound()) { 
        T upper = range.upperEndpoint();
        if (range.isUpperBoundOpen()) { 
          upper = domain.previous(upper);
        } 
        return closed(lower, upper);
      } else { 
        return atLeast(lower);
      } 
    } else if (range.hasUpperBound()) { 
      T upper = range.upperEndpoint();
      if (range.isUpperBoundOpen()) { 
        upper = domain.previous(upper);
      } 
      return atMost(upper);
    } else { 
      throw new IllegalArgumentException("Invalid range: no endpoints");
    } 
Connect your IDE to all the code out there  Get Codota for Java