Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashMap; import java.util.StringTokenizer; import java.util.Vector; public class Main { static HashMap<String, Vector<String>> posMap = new HashMap<String, Vector<String>>(); static HashMap<String, Vector<String>> negMap = new HashMap<String, Vector<String>>(); public static void initializeMap(InputStream is, boolean isPositive) { try { BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); String line = null; while ((line = reader.readLine()) != null) { StringTokenizer tokenizer = new StringTokenizer(line, "\t\n", false); String key = null; Vector<String> tokens = new Vector<String>(); if (tokenizer.hasMoreTokens()) key = tokenizer.nextToken(); while (tokenizer.hasMoreTokens()) { tokens.add(tokenizer.nextToken()); } if (key != null) { if (isPositive) posMap.put(key, tokens); else negMap.put(key, tokens); } } } catch (Exception e) { } } }