export type ForeachMapAction = (key: K, value: V) => void; /** * IMap接口 */ export interface IMap { /** * 数量 */ Count(): number; /** * 添加 * @param key Key * @param value Value * @return Value */ Add(key: K, value: V): V; /** * 移除 * @param key Key * @return Value */ Remove(key: K): V; /** * 修改已有Key的Value值 * @param key Key * @param value New Value * @return True: 修改成功; False: 修改失败 */ Replace(key: K, value: V): boolean; /** * 包含 * @param key Key * @return True: 包含; False: 未包含 */ ContainsKey(key: K): boolean; /** * 获取Value * @param key Key * @return Value */ Value(key: K): V; /** * 所有Keys * @return K[] */ Keys(): K[]; /** * 所有Values * @return V[] */ Values(): V[]; /** * 迭代 * @param callback 回调 */ Foreach(callback: ForeachMapAction, thisArg?: any): void; /** * 清空 */ Clear(): void; }