com.almondtools.util.collections.HashMaps Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rexlex Show documentation
Show all versions of rexlex Show documentation
Regular expression matchers, searcher, lexers based on deterministic finite automata
package com.almondtools.util.collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
public class HashMaps {
private HashMap map;
private HashMaps(boolean linked) {
if (linked) {
this.map = new LinkedHashMap();
} else {
this.map = new HashMap();
}
}
private HashMaps(HashMap map) {
this.map = new HashMap(map);
}
public HashMaps put(K key, V value) {
map.put(key, value);
return this;
}
public static HashMaps linked() {
return new HashMaps(true);
}
public static HashMaps hashed() {
return new HashMaps(false);
}
public static HashMaps invert(Map toinvert) {
HashMaps maps = new HashMaps(false);
for (Map.Entry entry: toinvert.entrySet()) {
maps.put(entry.getValue(), entry.getKey());
}
return maps;
}
public HashMap build() {
return map;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy