Created
June 20, 2014 14:02
-
-
Save aikar/f63d47b671c3325387bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.empireminecraft.util.java; | |
import java.util.HashMap; | |
import java.util.Map; | |
public class CaselessHashMap<T> extends HashMap<String, T> { | |
public CaselessHashMap(int initialCapacity, float loadFactor) { | |
super(initialCapacity, loadFactor); | |
} | |
public CaselessHashMap(int initialCapacity) { | |
super(initialCapacity); | |
} | |
public CaselessHashMap() { | |
} | |
public CaselessHashMap(Map<? extends String, ? extends T> m) { | |
super(m); | |
} | |
@Override | |
public T put(String key, T value) { | |
return super.put(key.toLowerCase(), value); | |
} | |
@Override | |
public T get(Object key) { | |
return super.get(((String)key).toLowerCase()); | |
} | |
@Override | |
public void putAll(Map<? extends String, ? extends T> m) { | |
for (Map.Entry<? extends String, ? extends T> entry : m.entrySet()) { | |
put(entry.getKey(), entry.getValue()); | |
} | |
} | |
@Override | |
public T remove(Object key) { | |
return super.remove(((String) key).toLowerCase()); | |
} | |
@Override | |
public boolean containsKey(Object key) { | |
return super.containsKey(((String)key).toLowerCase()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment