library-ts/browser/tools/MapList.ts

27 lines
430 B
TypeScript

import { Arrays } from "./Arrays";
export class MapList
{
static add<K,V>( map:Map<K,V[]>, k:K, v:V )
{
if ( ! map.has( k ) )
{
map.set( k, [] );
}
map.get( k ).push( v );
}
static shiftToSize<K,V>( map:Map<K,V[]>, k:K, num:number )
{
if ( ! map.has( k ) )
{
return;
}
let array = map.get( k );
Arrays.shiftToSize( array, num );
}
}