using System.Collections;
using System.Collections.Generic;
using System.Text;
using System;

namespace Rokojori
{
  public class Dictionaries
  { 
    public static void RemoveAll<K,V>( Dictionary<K,V> dictionary, Func<K,V,bool> predicate )
    {
      var list = new List<K>();

      foreach ( var kv in dictionary )
      {
        if ( predicate( kv.Key, kv.Value ) )
        {
          list.Add( kv.Key );
        }
      }

      list.ForEach( k => dictionary.Remove( k ) );
    }
  }
}