Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String mapGetValueIgnoringCase(java.util.Map<String, String> map, String key) {
        if (map.containsKey(key)) {
            return map.get(key);
        }
        for (String f : map.keySet()) {
            if (equalsIgnoreCase(f, key)) {
                return map.get(f);
            }
        }
        return null;
    }

    private static boolean equalsIgnoreCase(String s1, String s2) {
        if (s1 == s2) {
            return true;
        }
        if (s1 == null) {
            return false;
        }
        if (s1.equalsIgnoreCase(s2)) {
            return true;
        }
        return false;
    }
}