Here you can find the source of loadNameMap(String mapName, boolean reverseMap)
private static Map<String, List<String>> loadNameMap(String mapName, boolean reverseMap) throws IOException
//package com.java2s; //License from project: LGPL import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; public class Main { private static Map<String, List<String>> loadNameMap(String mapName, boolean reverseMap) throws IOException { Map<String, List<String>> rtrn = new HashMap<String, List<String>>(); String line;/*from w w w . ja va 2 s .c om*/ BufferedReader br = new BufferedReader(new FileReader(mapName)); while ((line = br.readLine()) != null) { String[] lineSplit = line.split("\t"); String n1 = lineSplit[0]; String n2 = lineSplit[1]; if (reverseMap) { n1 = lineSplit[1]; n2 = lineSplit[0]; } if (!rtrn.containsKey(n1)) { List<String> lst = new LinkedList<String>(); rtrn.put(n1, lst); } rtrn.get(n1).add(n2); } br.close(); return rtrn; } }