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.List;
import java.util.Map;
import java.util.Map.Entry;

public class Main {
    /**
     * retain the keyIdMap keys not in keyValueMap.keys()
     * 
     * @param keyValueMap
     * @param keyIdMap
     * @return
     */
    public static <G> List<G> retainKeysNotIn(Map<String, G> keyIdMap, Map<String, ?> keyValueMap) {
        List<G> result = new ArrayList<G>();
        for (Entry<String, G> keyIdMapEntry : keyIdMap.entrySet()) {
            if (keyValueMap.get(keyIdMapEntry.getKey()) == null) {
                result.add(keyIdMapEntry.getValue());
            }
        }
        return result;
    }
}