Example #1
0
 public ImmSortedMapDebugView(ImmSortedMap <TKey, TValue> map)
 {
     _inner        = map;
     zIterableView = new IterableDebugView <KeyValuePair <TKey, TValue> > (map);
 }
Example #2
0
 protected override IMapBuilder <TKey, TValue, ImmSortedMap <TKey, TValue> > BuilderFrom(ImmSortedMap <TKey, TValue> collection)
 {
     return(new Builder(collection));
 }
Example #3
0
 protected override ImmSortedMap <TKey, TValue> Difference(ImmSortedMap <TKey, TValue> other)
 {
     return(Root.SymDifference(other.Root, Lineage.Mutable()).WrapMap(Comparer));
 }
Example #4
0
 protected override ImmSortedMap <TKey, TValue> Subtract(ImmSortedMap <TKey, TValue> other, ValueSelector <TKey, TValue, TValue, Optional <TValue> > subtraction = null)
 {
     return(Root.Except(other.Root, Lineage.Mutable(), subtraction).WrapMap(Comparer));
 }
Example #5
0
 protected override ImmSortedMap <TKey, TValue> Merge(ImmSortedMap <TKey, TValue> other,
                                                      ValueSelector <TKey, TValue, TValue, TValue> collision = null)
 {
     return(Root.Union(other.Root, collision, Lineage.Mutable()).WrapMap(Comparer));
 }
Example #6
0
 protected override ImmSortedMap <TKey, TValue> Join(ImmSortedMap <TKey, TValue> other,
                                                     ValueSelector <TKey, TValue, TValue, TValue> collision = null)
 {
     return(Root.Intersect(other.Root, Lineage.Mutable(), collision).WrapMap(Comparer));
 }
Example #7
0
 protected override bool IsCompatibleWith(ImmSortedMap <TKey, TValue> other)
 {
     return(Comparer.Equals(other.Comparer));
 }
Example #8
0
 public Builder(ImmSortedMap <TKey, TValue> inner)
     : this(inner.Root, inner.Comparer)
 {
 }
Example #9
0
 /// <summary>
 /// Returns an empty ordered map for the specified types using the specified comparison handler.
 /// </summary>
 /// <typeparam name="TKey"></typeparam>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="cmp"></param>
 /// <returns></returns>
 public static ImmSortedMap <TKey, TValue> Empty <TKey, TValue>(IComparer <TKey> cmp)
 {
     return(ImmSortedMap <TKey, TValue> .Empty(cmp));
 }
Example #10
0
 /// <summary>
 /// Returns an empty ordered map for the specified types using default comparison semantics.
 /// </summary>
 /// <typeparam name="TKey"></typeparam>
 /// <typeparam name="TValue"></typeparam>
 /// <returns></returns>
 public static ImmSortedMap <TKey, TValue> Empty <TKey, TValue>()
     where TKey : IComparable <TKey>
 {
     return(ImmSortedMap <TKey, TValue> .Empty(null));
 }
Example #11
0
 /// <summary>
 /// Returns a new empty ordered map using the specified comparer.
 /// </summary>
 /// <typeparam name="TKey"></typeparam>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="comparer"></param>
 /// <returns></returns>
 public static ImmSortedMap <TKey, TValue> CreateOrderedMap <TKey, TValue>(this IComparer <TKey> comparer)
 {
     return(ImmSortedMap <TKey, TValue> .Empty(comparer));
 }
Example #12
0
 /// <summary>
 /// Converts a sequence of key-value pairs to an ordered map, with the specified comparison semantics.
 /// </summary>
 /// <typeparam name="TKey"></typeparam>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="kvps"></param>
 /// <param name="cmp"></param>
 /// <returns></returns>
 public static ImmSortedMap <TKey, TValue> ToImmSortedMap <TKey, TValue>(
     this IEnumerable <KeyValuePair <TKey, TValue> > kvps, IComparer <TKey> cmp)
 {
     return(ImmSortedMap <TKey, TValue> .Empty(cmp).AddRange(kvps));
 }
Example #13
0
 /// <summary>
 /// Converts a sequence of key-value pairs to an ordered map. The keys must be IComparable.
 /// </summary>
 /// <typeparam name="TKey"></typeparam>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="kvps"></param>
 /// <returns></returns>
 public static ImmSortedMap <TKey, TValue> ToImmSortedMap <TKey, TValue>(
     this IEnumerable <KeyValuePair <TKey, TValue> > kvps)
     where TKey : IComparable <TKey>
 {
     return(ImmSortedMap <TKey, TValue> .Empty(null).AddRange(kvps));
 }