79 lines
1.9 KiB
Java
79 lines
1.9 KiB
Java
package net.minecraft.util;
|
|
|
|
import java.util.Collection;
|
|
import java.util.Set;
|
|
import java.util.Iterator;
|
|
import java.util.Locale;
|
|
import com.google.common.collect.Maps;
|
|
import java.util.Map;
|
|
|
|
public class InsensitiveStringMap<V> implements Map<String, V> {
|
|
private final Map<String, V> map;
|
|
|
|
public InsensitiveStringMap() {
|
|
this.map = Maps.newLinkedHashMap();
|
|
}
|
|
|
|
@Override
|
|
public int size() {
|
|
return this.map.size();
|
|
}
|
|
|
|
@Override
|
|
public boolean isEmpty() {
|
|
return this.map.isEmpty();
|
|
}
|
|
|
|
@Override
|
|
public boolean containsKey(final Object object) {
|
|
return this.map.containsKey(object.toString().toLowerCase(Locale.ROOT));
|
|
}
|
|
|
|
@Override
|
|
public boolean containsValue(final Object object) {
|
|
return this.map.containsValue(object);
|
|
}
|
|
|
|
@Override
|
|
public V get(final Object object) {
|
|
return this.map.get(object.toString().toLowerCase(Locale.ROOT));
|
|
}
|
|
|
|
@Override
|
|
public V put(final String string, final V object) {
|
|
return this.map.put(string.toLowerCase(Locale.ROOT), object);
|
|
}
|
|
|
|
@Override
|
|
public V remove(final Object object) {
|
|
return this.map.remove(object.toString().toLowerCase(Locale.ROOT));
|
|
}
|
|
|
|
@Override
|
|
public void putAll(final Map<? extends String, ? extends V> map) {
|
|
for (final Entry<? extends String, ? extends V> entry4 : map.entrySet()) {
|
|
this.put((String)entry4.getKey(), entry4.getValue());
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void clear() {
|
|
this.map.clear();
|
|
}
|
|
|
|
@Override
|
|
public Set<String> keySet() {
|
|
return this.map.keySet();
|
|
}
|
|
|
|
@Override
|
|
public Collection<V> values() {
|
|
return this.map.values();
|
|
}
|
|
|
|
@Override
|
|
public Set<Entry<String, V>> entrySet() {
|
|
return this.map.entrySet();
|
|
}
|
|
}
|