The 'size' constraint - field must be a {@link String}, {@link Map}, {@link Collection} or array
with a given minimum and maximum length.
@param min the minimum length
@param max the maximum length
@return constraint
494485
public static Constraint size(final Number min, final Number max) {
		return new Constraint("size", sizePayload(min, max)) {
			public boolean isValid(Object actualValue) {
				if (actualValue != null && min != null && max != null) {
					if (actualValue instanceof String) {
						return !isOutOfRange(((String) actualValue).length(), min, max);
					} else if (actualValue instanceof Collection) {
						return !isOutOfRange(((Collection) actualValue).size(), min, max);
					} else if (actualValue instanceof Map) {
						return !isOutOfRange(((Map) actualValue).size(), min, max);
					} else if (actualValue.getClass().isArray()) {
						return !isOutOfRange(ArrayUtils.getLength(actualValue), min, max);
					} else {
						return false;
					}
				}
				return true;
			}
		};
	}
727458
static Map<String, Object> sizePayload(final Object min, final Object max) {
		if (min == null || max == null) {
			return null;
		}
		Map<String, Object> payload = new LinkedHashMap<>();
		payload.put("min", min);
		payload.put("max", max);
		payload.put("message", MSG_PREFIX + VALIDATORS.get(Size.class));
		return payload;
	}
403008
public void setMinMax(int min, int max)
    {
        if(min >= max)
            throw new IllegalArgumentException("The input minimum (" + min + ") must be less than the given max (" + max  + ")");
        this.min = min;
        this.max = max;
    }
931474
def constrain (n, min, max):

    ''' '''

    if n < min:
        return min
    if n > max:
        return max
    return n
58059
public static <T extends Comparable<T>> ExtraConstraint<T>
                min(T minVal) {
        return min(minVal, true);
    }
528167
public Cell<C,T> width (Value<C,T> width) {
		minWidth = width;
		prefWidth = width;
		maxWidth = width;
		return this;
	}
1035979
public StringExpression min() {
        if (min == null) {
            min = Expressions.stringOperation(Ops.AggOps.MIN_AGG, mixin);
        }
        return min;
    }
193363
public static boolean isLimited(String string, int min, int max) {
        return isNotEmpty(string) && string.length() >= min && string.length() <= max;
    }
1214411
public void setOccurence(int min, int max) throws ParseException {
    if (!simplified) {
      if ((min < 0) || (min > max) || (max < 1)) {
        throw new ParseException("Illegal number {" + min + "," + max + "}");
      }
      if (min == 0) {
        optional = true;
      }
      minimumOccurence = Math.max(1, min);
      maximumOccurence = max;
    } else {
      throw new ParseException("already simplified");
    }
  }
1024293
public int getNumberBetween(final int min, final int max) {

    if (max < min) {
      throw new IllegalArgumentException(String.format("Minimum must be less than minimum (min=%d, max=%d)", min, max));
    }
    if (max == min) {
      return min;
    }

    return min + random.nextInt(max - min);
  }
1325503
static MinMax minmax(int[] input, final int start, final int length) {
        int max = input[start];
        int min = max;
        for (int i = length - 2, index = start + 1; i >= 0; i--, index++) {
            final int v = input[index];
            if (v > max) {
                max = v;
            }
            if (v < min) {
                min = v;
            }
        }

        return new MinMax(min, max);
    }
564487
public static void checkMinMax(int min, int max) {
    checkMin(min);
    checkMax(max);
    checkArgument(min <= max, "min > max");
  }
105844
public Cell<C,T> minSize (Value<C,T> size) {
		minWidth = size;
		minHeight = size;
		return this;
	}
461821
public Cell<C,T> maxSize (Value<C,T> size) {
		maxWidth = size;
		maxHeight = size;
		return this;
	}
147199
public Packer ensureCapacity(int minCapacity) {
		if (minCapacity <= buf.length)
			return this;
		switch (autoExtendPolicy) {
			case NONE:
				return this;
			case MINIMAL:
				break;
			case AUTO:
				minCapacity = roundAuto(minCapacity);
				break;
			case ROUND8:
				minCapacity = round(minCapacity, 8);
				break;
			case ROUND512:
				minCapacity = round(minCapacity, 512);
				break;
			case ROUND4096:
				minCapacity = round(minCapacity, 4096);
				break;
		}
		final byte[] newbuf = new byte[minCapacity];
		System.arraycopy(buf, 0, newbuf, 0, Math.min(buf.length, newbuf.length));
		buf = newbuf;
		bufLimit = buf.length;
		return this;
	}
132580
public ValidatorBuilderBigDecimal<PARENT> range(BigDecimal min, BigDecimal max) {

    return range(new Range<>(min, max));
  }
254953
public MinMax<C> combine(final MinMax<C> other) {
		_min = min(_comparator, _min, other._min);
		_max = max(_comparator, _max, other._max);
		_count += other._count;

		return this;
	}