public static Map<String,Integer> createIdxFromKey(String line,String seperator){
  String[] keys=line.split(seperator);
  Map<String,Integer> idxFromKey=new ConcurrentHashMap<String,Integer>();
  for (int i=0; i < keys.length; i++) {
    idxFromKey.put(keys[i],i);
  }
  return idxFromKey;
}

public static Map < String , Integer > createIdxFromKey ( String line , String seperator ) { String [ ] keys = line . split ( seperator ) ; Map < String , Integer > idxFromKey = new ConcurrentHashMap < String , Integer > ( ) ; for ( int i = 0 ; i < keys . length ; i ++ ) { idxFromKey . put ( keys [ i ] , i ) ; } return idxFromKey ; }
this is used to parse a header line from a tab - delimited urbansim header and generate a map that allows to look up column numbers ( starting from 0 ) by giving the header line . i . e . if you have a header " from_id < tab > to_id < tab > travel_time " , then idxfromkey . get ( " to_id " ) will return " 1 " . this makes the reading of column - oriented files independent from the sequence of the columns .
