question: public static < K , V > void readKV ( Map < Id < K > , Id < V > > yFromX , String key , Class < K > keyType , String value , Class < V > valueType , String filename ) { try { log . info ( "Starting to read some key-value pairs from " + filename ) ; BufferedReader reader = IOUtils . getBufferedReader ( filename ) ; String header = reader . readLine ( ) ; Map < String , Integer > idxFromKey = Utils . createIdxFromKey ( header , null ) ; String line = reader . readLine ( ) ; while ( line != null ) { String [ ] parts = line . split ( "[\t\n]+" ) ; int idx = idxFromKey . get ( value ) ; Id < V > valueId = Id . create ( parts [ idx ] , valueType ) ; idx = idxFromKey . get ( key ) ; Id < K > keyId = Id . create ( parts [ idx ] , keyType ) ; yFromX . put ( keyId , valueId ) ; line = reader . readLine ( ) ; } } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } log . info ( "DONE with reading some key-value pairs." ) ; }
target:  This reads a key-value mapping from a column-oriented file.  The "String key" and the "String value" parameters give the column headers.  The IdFactories are there so that there is at least some runtime safety net: If you pull an Id that you did not expect, it will complain.   "Map<Id,Id> yFromx" contains the result.