public static Map<String,Integer> classNamesToMapping(List<String> labels){
  Map<String,Integer> mapping=new HashMap<String,Integer>();
  for (int i=0; i < labels.size(); i++) {
    mapping.put(labels.get(i),i);
  }
  return mapping;
}

public static Map < String , Integer > classNamesToMapping ( List < String > labels ) { Map < String , Integer > mapping = new HashMap < String , Integer > ( ) ; for ( int i = 0 ; i < labels . size ( ) ; i ++ ) { mapping . put ( labels . get ( i ) , i ) ; } return mapping ; }
from a list of labels , creates a mapping from strings to indices .
