question: public static String listInsertAt ( String list , int pos , String value , String delimiter , boolean ignoreEmpty ) throws ExpressionException { if ( pos < 1 ) throw new ExpressionException ( "invalid string list index [" + ( pos ) + "]" ) ; char [ ] del = delimiter . toCharArray ( ) ; char c ; StringBuilder result = new StringBuilder ( ) ; String end = "" ; int len ; if ( ignoreEmpty ) { outer : while ( list . length ( ) > 0 ) { c = list . charAt ( 0 ) ; for ( int i = 0 ; i < del . length ; i ++ ) { if ( c == del [ i ] ) { list = list . substring ( 1 ) ; result . append ( c ) ; continue outer ; } } break ; } } if ( ignoreEmpty ) { outer : while ( list . length ( ) > 0 ) { c = list . charAt ( list . length ( ) - 1 ) ; for ( int i = 0 ; i < del . length ; i ++ ) { if ( c == del [ i ] ) { len = list . length ( ) ; list = list . substring ( 0 , len - 1 < 0 ? 0 : len - 1 ) ; end = c + end ; continue outer ; } } break ; } } len = list . length ( ) ; int last = 0 ; int count = 0 ; outer : for ( int i = 0 ; i < len ; i ++ ) { c = list . charAt ( i ) ; for ( int y = 0 ; y < del . length ; y ++ ) { if ( c == del [ y ] ) { if ( ! ignoreEmpty || last < i ) { if ( pos == ++ count ) { result . append ( value ) ; result . append ( del [ 0 ] ) ; } } result . append ( list . substring ( last , i ) ) ; result . append ( c ) ; last = i + 1 ; continue outer ; } } } count ++ ; if ( last <= len ) { if ( pos == count ) { result . append ( value ) ; result . append ( del [ 0 ] ) ; } result . append ( list . substring ( last ) ) ; } if ( pos > count ) { throw new ExpressionException ( "invalid string list index [" + ( pos ) + "], indexes go from 1 to " + ( count ) ) ; } return result + end ; }
target:  casts a list to Array object, remove all empty items at start and end of the list and store count to info