Skip to content

Commit f7468aa

Browse files
committed
Add mutable.SeqMap plus make LinkedHashMap extend it
1 parent be4e709 commit f7468aa

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

library/src/scala/collection/immutable/SeqMap.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import scala.collection.mutable.{Builder, ImmutableBuilder}
1919
* @author Matthew de Detrich
2020
* @version 2.13
2121
* @since 2.13
22-
* @define coll immutable linked map
22+
* @define coll immutable seq map
2323
* @define Coll `immutable.SeqMap`
2424
*/
2525

library/src/scala/collection/mutable/LinkedHashMap.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ object LinkedHashMap extends MapFactory[LinkedHashMap] {
4646
*/
4747
class LinkedHashMap[K, V]
4848
extends AbstractMap[K, V]
49+
with SeqMap[K, V]
4950
with MapOps[K, V, LinkedHashMap, LinkedHashMap[K, V]]
5051
with StrictOptimizedIterableOps[(K, V), Iterable, LinkedHashMap[K, V]] {
5152

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package scala
2+
package collection
3+
package mutable
4+
5+
import java.io.{ObjectInputStream, ObjectOutputStream}
6+
7+
import scala.collection.mutable.{Builder, ImmutableBuilder}
8+
9+
/**
10+
* A generic trait for ordered mutable maps. Concrete classes have to provide
11+
* functionality for the abstract methods in `SeqMap`.
12+
*
13+
* Note that when checking for equality [[SeqMap]] does not take into account
14+
* ordering.
15+
*
16+
* @tparam K the type of the keys contained in this linked map.
17+
* @tparam V the type of the values associated with the keys in this linked map.
18+
*
19+
* @author Matthew de Detrich
20+
* @version 2.13
21+
* @since 2.13
22+
* @define coll mutable Seq map
23+
* @define Coll `mutable.SeqMap`
24+
*/
25+
26+
trait SeqMap[K, V] extends AbstractMap[K, V]
27+
with MapOps[K, V, SeqMap, SeqMap[K, V]]

0 commit comments

Comments
 (0)