Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.*;

public class Main {
    /**
     *  Retrieves the first value of a MultiMap index
     *  @param multiMap (Map<String,LinkedList<String>>)
     *  @param index (String)
     *  @return String
     **/
    public static String popMultiMap(Map<String, LinkedList<String>> multiMap, String key) {
        if (multiMap == null)
            return (null);

        if (multiMap.containsKey(key)) {
            LinkedList<String> list = multiMap.get(key);
            if (list != null) {
                return (list.pop());
            } else {
                return (null);
            }
        } else {
            return (null);
        }
    }
}