1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
using System.Collections.Generic;
namespace Filter
{
internal class BlackWhite<T>
{
private Dictionary<T, bool> black = new Dictionary<T, bool>();
private Dictionary<T, bool> white = new Dictionary<T, bool>();
public BlackWhite(IList<T> black, IList<T> white)
{
foreach (T t in black) {
this.black [t] = true;
}
foreach (T t in white) {
this.white [t] = true;
}
}
public List<T> GetGoodList(IList<T> inputList)
{
List<T> goodList = new List<T>();
foreach (T t in inputList)
{
if (white.ContainsKey(t) || !black.ContainsKey(t)) {
goodList.Add(t);
}
}
return goodList;
}
}
}
|