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()));
  }
}

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 ( ) ) ) ; } }
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 .
