Ejemplo n.º 1
0
 ImmMap <TKey, TValue> Subtract <TValue2>(ImmMap <TKey, TValue2> other,
                                          ValueSelector <TKey, TValue, TValue2, Optional <TValue> > subtraction = null)
 {
     other.CheckNotNull("other");
     return(_root.Except(other._root, Lineage.Mutable(), subtraction).WrapMap(_equality));
 }
Ejemplo n.º 2
0
 protected override ImmMap <TKey, TValue> Join(ImmMap <TKey, TValue> other,
                                               ValueSelector <TKey, TValue, TValue, TValue> collision = null)
 {
     return(_root.Intersect(other._root, Lineage.Mutable(), collision).WrapMap(_equality));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns an empty ImmMap that uses the specified equality comparer to equate elements.
 /// </summary>
 /// <typeparam name="TKey"></typeparam>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="eq">Optionally, the equality comparer used to equate keys. Otherwise, the default equality comparer is used.</param>
 /// <returns></returns>
 public static ImmMap <TKey, TValue> Empty <TKey, TValue>(IEqualityComparer <TKey> eq = null)
 {
     return(ImmMap <TKey, TValue> .Empty(eq ?? FastEquality <TKey> .Default));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Converts the specified sequence of key-value pairs to a ImmMap, using the optionally specified equality comparer for determining equality between keys.
 /// </summary>
 /// <typeparam name="TKey"></typeparam>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="kvps">A sequence of key-value pairs.</param>
 /// <param name="eq">An equality comparer</param>
 /// <returns></returns>
 public static ImmMap <TKey, TValue> ToImmMap <TKey, TValue>(this IEnumerable <KeyValuePair <TKey, TValue> > kvps,
                                                             IEqualityComparer <TKey> eq = null)
 {
     return(ImmMap <TKey, TValue> .Empty(eq).AddRange(kvps));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Uses the specified IEqualityComparer as a factory, producing an empty ImmMap using that comparer.
 /// </summary>
 /// <typeparam name="TKey"></typeparam>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="eq"></param>
 /// <returns></returns>
 public static ImmMap <TKey, TValue> CreateMap <TKey, TValue>(this IEqualityComparer <TKey> eq)
 {
     return(ImmMap <TKey, TValue> .Empty(eq));
 }