Guava DiscreteDomain - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava DiscreteDomain class.

This code example shows how to use the following methods:maxValue, minValue
This code example shows how to use the following methods:next, previous
  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);

4
CodeRank
See Code Examples for Guava DiscreteDomain Methods: