All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.marksman.enhancediterables.Validation Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
package dev.marksman.enhancediterables;

final class Validation {

    private Validation() {
    }

    private static void requirePositive(String paramName, int value) {
        if (value < 1) {
            throw new IllegalArgumentException(paramName + " must be >= 1");
        }
    }

    private static void requireNonNegative(String paramName, int value) {
        if (value < 0) {
            throw new IllegalArgumentException(paramName + " must be >= 0");
        }
    }

    static void validateTake(int count) {
        requireNonNegative("count", count);
    }

    static void validateDrop(int count) {
        requireNonNegative("count", count);
    }

    static void validateSlide(int k) {
        requirePositive("k", k);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy