com.hibegin.common.util.ObjectUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simplewebserver Show documentation
Show all versions of simplewebserver Show documentation
Simple, flexible, less dependent, more extended. Less memory footprint, can quickly build Web project.
Can quickly run embedded, Android devices
package com.hibegin.common.util;
import java.util.Objects;
import java.util.function.Supplier;
public class ObjectUtil {
public static T requireNonNullElse(T obj, T defaultObj) {
return (T)(obj != null ? obj : Objects.requireNonNull(defaultObj, "defaultObj"));
}
public static T requireNonNullElseGet(T obj, Supplier extends T> supplier) {
return (T)(obj != null ? obj : Objects.requireNonNull(((Supplier)Objects.requireNonNull(supplier, "supplier")).get(), "supplier.get()"));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy