index.d.ts 952 B

12345678910111213141516171819202122232425
  1. import { Base } from "../../ContainerBase";
  2. declare abstract class HashContainer<K> extends Base {
  3. protected constructor(initBucketNum?: number, hashFunc?: (x: K) => number);
  4. clear(): void;
  5. /**
  6. * @description Iterate over all elements in the container.
  7. * @param callback Callback function like Array.forEach.
  8. */
  9. abstract forEach(callback: (element: unknown, index: number) => void): void;
  10. /**
  11. * @description Remove the elements of the specified value.
  12. * @param key The element you want to remove.
  13. */
  14. abstract eraseElementByKey(key: K): void;
  15. /**
  16. * @param key The element you want to find.
  17. * @return Boolean about if the specified element in the hash set.
  18. */
  19. abstract find(key: K): void;
  20. /**
  21. * @description Using for `for...of` syntax like Array.
  22. */
  23. abstract [Symbol.iterator](): Generator<K | [K, unknown], void, undefined>;
  24. }
  25. export default HashContainer;