public static String [ ] removeNull ( String [ ] in ) { if ( in == null ) { return new String [ 0 ] ; } ArrayList < String > arr = new ArrayList ( ) ; for ( int i = 0 ; i < in . length ; i ++ ) { if ( in [ i ] != null ) { arr . add ( in [ i ] ) ; } } if ( in . length == arr . size ( ) ) { return in ; } else { return arr . toArray ( new String [ 0 ] ) ; } }
Remove the null value in the input String array