@@ -10,15 +10,15 @@ open Microsoft.FSharp.Collections
1010// one entry. So use two hash tables: one for the main entries and one for the overflow.
1111[<Sealed>]
1212type internal HashMultiMap < 'Key , 'Value >( n : int , hasheq : IEqualityComparer < 'Key >) =
13- let firstEntries = new Dictionary<_,_>( n, hasheq);
14- let rest = new Dictionary<_,_>( 3 , hasheq);
13+ let firstEntries = Dictionary<_,_>( n, hasheq)
14+ let rest = Dictionary<_,_>( 3 , hasheq)
1515
16- new ( hasheq : IEqualityComparer < 'Key >) = new HashMultiMap< 'Key, 'Value>( 11 , hasheq)
16+ new ( hasheq : IEqualityComparer < 'Key >) = HashMultiMap< 'Key, 'Value>( 11 , hasheq)
1717 new ( seq : seq < 'Key * 'Value >, hasheq : IEqualityComparer < 'Key >) as x =
1818 new HashMultiMap< 'Key, 'Value>( 11 , hasheq)
1919 then seq |> Seq.iter ( fun ( k , v ) -> x.Add( k, v))
2020
21- member x.GetRest ( k ) =
21+ member x.GetRest ( k ) =
2222 let mutable res = []
2323 let ok = rest.TryGetValue( k,& res)
2424 if ok then res else []
@@ -37,9 +37,10 @@ type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>)
3737 member x.FirstEntries = firstEntries
3838 member x.Rest = rest
3939 member x.Copy () =
40- let res = new HashMultiMap< 'Key, 'Value>( firstEntries.Count, firstEntries.Comparer)
40+ let res = HashMultiMap< 'Key, 'Value>( firstEntries.Count, firstEntries.Comparer)
4141 for kvp in firstEntries do
4242 res.FirstEntries.Add( kvp.Key, kvp.Value)
43+
4344 for kvp in rest do
4445 res.Rest.Add( kvp.Key, kvp.Value)
4546 res
@@ -48,7 +49,7 @@ type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>)
4849 with get( y : 'Key ) =
4950 let mutable res = Unchecked.defaultof< 'Value>
5051 let ok = firstEntries.TryGetValue( y,& res)
51- if ok then res else raise ( new System.Collections.Generic. KeyNotFoundException( " The item was not found in collection" ))
52+ if ok then res else raise ( KeyNotFoundException( " The item was not found in collection" ))
5253 and set ( y : 'Key ) ( z : 'Value ) =
5354 x.Replace( y, z)
5455
@@ -61,7 +62,7 @@ type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>)
6162 let mutable res = acc
6263 for kvp in firstEntries do
6364 res <- f kvp.Key kvp.Value res
64- match x.GetRest( kvp.Key) with
65+ match x.GetRest( kvp.Key) with
6566 | [] -> ()
6667 | rest ->
6768 for z in rest do
@@ -71,7 +72,7 @@ type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>)
7172 member x.Iterate ( f ) =
7273 for kvp in firstEntries do
7374 f kvp.Key kvp.Value
74- match x.GetRest( kvp.Key) with
75+ match x.GetRest( kvp.Key) with
7576 | [] -> ()
7677 | rest ->
7778 for z in rest do
@@ -105,7 +106,7 @@ type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>)
105106 member x.Replace ( y , z ) =
106107 firstEntries.[ y] <- z
107108
108- member x.TryFind ( y ) =
109+ member x.TryFind ( y ) =
109110 let mutable res = Unchecked.defaultof< 'Value>
110111 let ok = firstEntries.TryGetValue( y,& res)
111112 if ok then Some( res) else None
@@ -114,7 +115,7 @@ type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>)
114115
115116 interface IEnumerable< KeyValuePair< 'Key, 'Value>> with
116117 member s.GetEnumerator () =
117- let elems = new System.Collections.Generic. List<_>( firstEntries.Count + rest.Count)
118+ let elems = List<_>( firstEntries.Count + rest.Count)
118119 for kvp in firstEntries do
119120 elems.Add( kvp)
120121 for z in s.GetRest( kvp.Key) do
0 commit comments