ComparableExtensions<T extends Comparable<T>> extension

adds limit extensions on Comparable

on
  • T

Methods

limitTo(T min, T max) → T

Available on T, provided by the ComparableExtensions extension

returns this if it is between min and max (inclusive) otherwise returns min or max whichever is closer
withLowerLimit(T min) → T

Available on T, provided by the ComparableExtensions extension

returns this if it is not greater than max, otherwise max
withUpperLimit(T max) → T

Available on T, provided by the ComparableExtensions extension

returns this if it is not greater than max, otherwise max