Beispiel #1
0
 /// <summary>
 /// Union of 2 sets, 1 set is result of union.
 /// </summary>
 /// <param name="secondSet"></param>
 public void Union(SetClass<T> secondSet)
 {
     foreach (var element in secondSet.elements)
     {
         InsertElement((T)element);
     }
 }
Beispiel #2
0
 public static SetClass<T> Intersection(SetClass<T> firstSet,SetClass<T> secondSet)
 {
     SetClass<T> resultSet = new SetClass<T>();
     foreach (var element in secondSet.elements)
     {
         if (firstSet.Contains((T)element))
         {
             resultSet.InsertElement((T)element);
         }
     }
     return resultSet;
 }