Here you can find the source of createMap(Iterator
private static Map<String, String> createMap(Iterator<String> iter)
//package com.java2s; //License from project: Apache License import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class Main { private static Map<String, String> createMap(Iterator<String> iter) { boolean finished = false; Map<String, String> m = new HashMap<String, String>(); while (iter.hasNext() && !finished) { String row = iter.next(); if (row.startsWith("~")) { finished = true;//w w w.j ava2s. c om } else { String[] tokens = row.split("\\^"); m.put(tokens[1].trim(), tokens[0].substring(1).trim()); } } return m; } }