12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- export type ForeachMapAction<K, V> = (key: K, value: V) => void;
- /**
- * IMap接口
- */
- export interface IMap<K, V> {
- /**
- * 数量
- */
- 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<K, V>, thisArg?: any): void;
- /**
- * 清空
- */
- Clear(): void;
- }
|