Skip to content
Reference > Methods

noNull(value1,value2,additionalValues)

Definition

Object noNull(Object value1, Object value2, Object ... additionalValues)

Description

Returns the first non-null value supplied (starting at left). If all values are null, then null is returned. Returns null if both supplied values are null.

Parameter Definition

Name Type Description
value1 Object value to test for null and return, unless null
value2 Object
additionalValues Object...

Examples

1
2
3
4
Integer r1 = noNull(32,46); // r1 == 32
Integer r2 = noNull(null,46); // r2 == 46
Integer r3 = noNull(null,null,20,null); // r3 == 20
Object r4 = noNull(null,null,null,null); // r4 == null