public static < T > T getFirstNotNullValue ( final Collection < T > collection ) { if ( isNotEmpty ( collection ) ) { for ( T element : collection ) { if ( element != null ) { return element ; } } } return null ; }
Returns the first not null element if the collection is not null and have not null value else return null .