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

com.databasesandlife.util.Coalescor Maven / Gradle / Ivy

There is a newer version: 21.0.1
Show newest version
package com.databasesandlife.util;

/**
 * @deprecated Use {@link java.util.Optional} instead, as its {@link java.util.Optional#orElse(Object)} method
 *     returns a non-null object that the IntelliJ can verify as non-null.
 * @author This source is copyright Adrian Smith and licensed under the LGPL 3.
 * @see Project on GitHub
 */
@Deprecated
public class Coalescor {

    @SafeVarargs 
    public static T coalesce(T... values) {
        for (var i = 0; i < values.length; i++) {
            if (values[i] != null) return values[i];
        }
        return null;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy