public ImmSortedMapDebugView(ImmSortedMap <TKey, TValue> map) { _inner = map; zIterableView = new IterableDebugView <KeyValuePair <TKey, TValue> > (map); }
protected override IMapBuilder <TKey, TValue, ImmSortedMap <TKey, TValue> > BuilderFrom(ImmSortedMap <TKey, TValue> collection) { return(new Builder(collection)); }
protected override ImmSortedMap <TKey, TValue> Difference(ImmSortedMap <TKey, TValue> other) { return(Root.SymDifference(other.Root, Lineage.Mutable()).WrapMap(Comparer)); }
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)); }
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)); }
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)); }
protected override bool IsCompatibleWith(ImmSortedMap <TKey, TValue> other) { return(Comparer.Equals(other.Comparer)); }
public Builder(ImmSortedMap <TKey, TValue> inner) : this(inner.Root, inner.Comparer) { }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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)); }