-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
ImmutableMap
to prevent BM persist where unsupported
- Loading branch information
Showing
6 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package is.hail.utils | ||
|
||
import scala.collection.mutable | ||
|
||
case class ImmutableMap[K, V](m: Map[K, V]) extends mutable.AbstractMap[K, V] { | ||
override def +=(kv: (K, V)): ImmutableMap.this.type = | ||
throw new UnsupportedOperationException() | ||
|
||
override def -=(key: K): ImmutableMap.this.type = | ||
throw new UnsupportedOperationException() | ||
|
||
override def get(key: K): Option[V] = | ||
m.get(key) | ||
|
||
override def iterator: Iterator[(K, V)] = | ||
m.iterator | ||
|
||
override def toMap[T, U](implicit ev: (K, V) <:< (T, U)): Map[T, U] = | ||
m.toMap | ||
} | ||
|
||
object ImmutableMap { | ||
def empty[K, V]: ImmutableMap[K, V] = | ||
ImmutableMap(Map.empty) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters