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

com.rometools.utils.Alternatives Maven / Gradle / Ivy

package com.rometools.utils;

public final class Alternatives {

    private Alternatives() {
    }

    /**
     * Returns the first object that is not null
     *
     * @param objects The objects to process
     * @return The first value that is not null. null when there is no not-null value
     */
    public static  T firstNotNull(final T... objects) {
        for (final T object : objects) {
            if (object != null) {
                return object;
            }
        }
        return null;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy