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 null
defaultProvider
- To provide the value, when instance
is null
instance
if not null
, otherwise the value provided by defaultProvider
public 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 null
defaultValue
- The value, when instance
is null
instance
if not null
, otherwise defaultValue
public 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 null
defaultValue
- The value, when instance
is null
instance
if not null
, otherwise defaultValue
Copyright © 2010–2017. All rights reserved.