@ SuppressWarnings ( "unchecked" ) public static < T > T [ ] nullToEmpty ( final T [ ] array ) { return array == null ? ( T [ ] ) EMPTY_ARRAY : array ; }
Return an empty array if input is null ; works as identity function otherwise . This function is useful in for statements if the iterable can be null .