public abstract class ObjectUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T extends CharSequence> |
getNonEmptyOrDefault(T instance,
T defaultValue)
Returns the given instance, if not
null or of zero length, or otherwise the given defaultValue. |
static <T> T |
getOrDefault(T instance,
Supplier<T> defaultProvider)
Returns the given instance, if not
null, or otherwise the value provided by defaultProvider. |
static <T> T |
getOrDefault(T instance,
T defaultValue)
Returns the given instance, if not
null, or otherwise the given defaultValue. |
public static <T> T getOrDefault(T instance,
Supplier<T> defaultProvider)
null, or otherwise the value provided by defaultProvider.T - The type of value to returninstance - The value to return, if not nulldefaultProvider - To provide the value, when instance is nullinstance if not null, otherwise the value provided by defaultProviderpublic static <T> T getOrDefault(T instance,
T defaultValue)
null, or otherwise the given defaultValue.T - The type of value to returninstance - The value to return, if not nulldefaultValue - The value, when instance is nullinstance if not null, otherwise defaultValuepublic static <T extends CharSequence> T getNonEmptyOrDefault(T instance, T defaultValue)
null or of zero length, or otherwise the given defaultValue.T - The type of value to returninstance - The value to return, if not nulldefaultValue - The value, when instance is nullinstance if not null, otherwise defaultValueCopyright © 2010–2017. All rights reserved.