package aiyh.utils.mapUtil; import java.util.LinkedHashMap; import java.util.Map; /** * @author EBU7-dev1-ayh * @date 2021/8/23 0023 15:06 * LinkedHashMap */ public class UtilLinkedHashMap extends LinkedHashMap implements Map { public UtilLinkedHashMap() { super(); } public UtilLinkedHashMap uPut(K key, V value) { this.put(key, value); return this; } public UtilLinkedHashMap uPutAll(Map m) { super.putAll(m); return this; } public UtilLinkedHashMap uReplace(K key, V value) { super.replace(key, value); return this; } public UtilLinkedHashMap filter(UtilMapFilter predicate) { UtilLinkedHashMap newMap = new UtilLinkedHashMap<>(); for (Entry entry : this.entrySet()) { if (predicate.test(entry.getKey(), entry.getValue())) { newMap.put(entry.getKey(), entry.getValue()); } } return newMap; } }