export class DoubleIndexedKV < K , V > { keyToValue = new Map < K , V > ( ) ; valueToKey = new Map < V , K > ( ) ; set ( key , value ) { this . keyToValue . set ( key , value ) ; this . valueToKey . set ( value , key ) ; } getByKey ( key ) { return this . keyToValue . get ( key ) ; } getByValue ( value ) { return this . valueToKey . get ( value ) ; } clear ( ) { this . keyToValue . clear ( ) ; this . valueToKey . clear ( ) ; } }