question: private void addTokenOccurrences ( Reader stream , Map < String , Integer > target ) throws java . io . IOException { String token ; String header = "" ; while ( ( token = nextToken ( stream ) ) != null ) { boolean endingLine = false ; if ( token . length ( ) > 0 && token . charAt ( token . length ( ) - 1 ) == '\n' ) { endingLine = true ; token = token . substring ( 0 , token . length ( ) - 1 ) ; } if ( token . length ( ) > 0 && header . length ( ) + token . length ( ) < 90 && ! allDigits ( token ) ) { if ( token . equals ( "From:" ) || token . equals ( "Return-Path:" ) || token . equals ( "Subject:" ) || token . equals ( "To:" ) ) { header = token ; if ( ! endingLine ) { continue ; } } token = header + token ; Integer value ; if ( target . containsKey ( token ) ) { value = target . get ( token ) + 1 ; } else { value = 1 ; } target . put ( token , value ) ; } if ( endingLine ) { header = "" ; } } }
target:  Parses a stream into tokens, and updates the target Map with the token/counts.