public String [ ] getArrayFilter ( String key ) { String value = filters . get ( key ) ; if ( value == null ) return null ; String [ ] array = new String [ 0 ] ; if ( value . startsWith ( "[" ) ) { if ( value . length ( ) > 2 ) array = value . substring ( 1 , value . length ( ) - 1 ) . split ( "," ) ; } else if ( value . length ( ) > 1 ) { array = value . split ( "," ) ; } for ( int i = 0 ; i < array . length ; i ++ ) { String item = array [ i ] ; if ( ( item . startsWith ( "\"" ) && item . endsWith ( "\"" ) ) || ( item . startsWith ( "'" ) && item . endsWith ( "'" ) ) && item . length ( ) > 1 ) array [ i ] = item . substring ( 1 , item . length ( ) - 2 ) ; } return array ; }
Empty list returns null ;