Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.ArrayList;

import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class Main {
    private static List<Map<String, String>> getKeys(Map<String, Integer> score, Integer value,
            List<Map<String, String>> all) {
        Iterator<String> iter = score.keySet().iterator();
        List<Map<String, String>> result = new ArrayList<Map<String, String>>();
        while (iter.hasNext()) {
            String next = iter.next();
            if (score.get(next).equals(value)) {
                Map<String, String> o = getFromFsNumber(next, all);
                if (o != null)
                    result.add(o);
            }
        }

        return result;
    }

    public static Map<String, String> getFromFsNumber(String fsNumber, List<Map<String, String>> all) {
        for (Map<String, String> o : all) {
            if (o != null && o.get("fsNumber") != null && fsNumber != null) {
                if (o.get("fsNumber").equalsIgnoreCase(fsNumber)) {
                    return o;
                }
            }
        }
        return null;
    }
}