// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Like {
    public static void main(String[] args) {
        Map koder = new HashMap();
        koder.put("11112", null);
        koder.put("11113", null);
        koder.put("1114", null);
        koder.put("2345", null);
        String reqex = "1.*";
        List results = new ArrayList();
        Pattern p = Pattern.compile(reqex);
        Set keys = koder.keySet();
        Iterator ite = keys.iterator();
        while (ite.hasNext()) {
            String candidate = (String) ite.next();
            Matcher m = p.matcher(candidate);
            if (m.matches()) {
                results.add(candidate);
            }
        }   
        System.out.println("results match: " + results);
    }
}
