public boolean removeField ( String field ) { HashMap map = fields ; StringTokenizer tk = new StringTokenizer ( field , "." ) ; if ( ! tk . hasMoreTokens ( ) ) return false ; ArrayList hist = new ArrayList ( ) ; while ( true ) { String s = tk . nextToken ( ) ; Object obj = map . get ( s ) ; if ( obj == null ) return false ; hist . add ( map ) ; hist . add ( s ) ; if ( tk . hasMoreTokens ( ) ) { if ( obj instanceof HashMap ) map = ( HashMap ) obj ; else return false ; } else { if ( obj instanceof HashMap ) return false ; else break ; } } for ( int k = hist . size ( ) - 2 ; k >= 0 ; k -= 2 ) { map = ( HashMap ) hist . get ( k ) ; String s = ( String ) hist . get ( k + 1 ) ; map . remove ( s ) ; if ( ! map . isEmpty ( ) ) break ; } return true ; }
Removes the field value .