question: public void makeTreeOfWritables ( Iterable < Pair < String , Integer > > flatData ) { Text key = new Text ( ) ; for ( Pair < String , Integer > pair : flatData ) { key . set ( pair . key ) ; ArrayList < IntWritable > valList ; if ( ! mockInput . containsKey ( key ) ) { valList = new ArrayList < > ( ) ; mockInput . put ( key , valList ) ; key = new Text ( ) ; } else valList = ( ArrayList < IntWritable > ) mockInput . get ( key ) ; valList . add ( new IntWritable ( pair . value ( ) ) ) ; } }
target:  Generate one-key-multiple-values tree from array of key-value pairs, and wrap its into Writable objects. The result is placed into mock input.