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 {

    @Deprecated
    public static void filterList(List<Map<String, Object>> list, String key) {

        List<Object> keys = new ArrayList<>();
        for (Map<String, Object> map : list) {

            Object object = map.get(key);

            if (!keys.contains(object)) {

                keys.add(object);
            } else {

                list.remove(map);
            }
        }
    }

    public static Map<Object, Object> get(List<Map<Object, Object>> list, Object key) {

        for (Map<Object, Object> map : list) {
            if (map.containsKey(key)) {

                return map;
            }
        }

        return null;
    }
}