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

org.javimmutable.collections.common.Conditions Maven / Gradle / Ivy

Go to download

Library providing immutable/persistent collection classes for Java. While collections are immutable they provide methods for adding and removing values by creating new modified copies of themselves. Each copy shares almost all of its structure with other copies to minimize memory consumption.

There is a newer version: 3.2.1
Show newest version
package org.javimmutable.collections.common;

/**
 * Utility class containing static methods for implementing pre and post conditions.
 */
public final class Conditions
{
    private Conditions()
    {
        // prevent class being instantiated
    }

    public static void stopNull(Object a)
    {
        if (a == null) {
            throw new NullPointerException();
        }
    }

    public static void stopNull(Object a,
                                Object b)
    {
        if (a == null || b == null) {
            throw new NullPointerException();
        }
    }

    public static void stopNull(Object a,
                                Object b,
                                Object c)
    {
        if (a == null || b == null || c == null) {
            throw new NullPointerException();
        }
    }

    public static void stopNull(Object a,
                                Object b,
                                Object c,
                                Object d)
    {
        if (a == null || b == null || c == null || d == null) {
            throw new NullPointerException();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy