rome/src/main/java/com/rometools/utils/Alternatives.java
Patrick Gotthard 5f65787ca5 Initial commit
2014-04-17 22:49:06 +02:00

23 lines
547 B
Java

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> T firstNotNull(final T... objects) {
for (final T object : objects) {
if (object != null) {
return object;
}
}
return null;
}
}