com.databasesandlife.util.Coalescor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-common Show documentation
Show all versions of java-common Show documentation
Utility classes developed at Adrian Smith Software (A.S.S.)
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;
}
}