提交学习笔记专用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
661 B

  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.DoubleIndexedKV = void 0;
  4. class DoubleIndexedKV {
  5. constructor() {
  6. this.keyToValue = new Map();
  7. this.valueToKey = new Map();
  8. }
  9. set(key, value) {
  10. this.keyToValue.set(key, value);
  11. this.valueToKey.set(value, key);
  12. }
  13. getByKey(key) {
  14. return this.keyToValue.get(key);
  15. }
  16. getByValue(value) {
  17. return this.valueToKey.get(value);
  18. }
  19. clear() {
  20. this.keyToValue.clear();
  21. this.valueToKey.clear();
  22. }
  23. }
  24. exports.DoubleIndexedKV = DoubleIndexedKV;
  25. //# sourceMappingURL=double-indexed-kv.js.map