Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static Map<String, Object> getMapValueSubset(Map<String, Object> list, String pattern) {
        HashMap<String, Object> result = new HashMap<>();

        for (String key : list.keySet()) {
            if (key.matches(pattern)) {
                result.put(key, list.get(key));
            }
        }

        return result;
    }
}