Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/19553#discussion_r146147889
--- Diff: core/src/main/scala/org/apache/spark/api/java/JavaUtils.scala ---
@@ -43,6 +43,13 @@ private[spark] object JavaUtils {
override def size: Int = underlying.size
+ // Delegate to implementation because AbstractMap implementation
iterates over whole key set
+ override def containsKey(key: AnyRef): Boolean = try {
--- End diff --
This reminds me that this whole class could go away once only Scala 2.12 is
supported, but that's a while away.
Simpler as this?
```
override def containsKey(key: AnyRef): Boolean = key match {
case a: A => underlying.contains(a)
case _ => false
}
```
if so then get() could be:
```
override def get(key: AnyRef): B = key match {
case a: A => underlying.getOrElse(a, null.asInstanceOf[B])
case _ => null.asInstanceOf[B]
}
```
What about other methods -- anything worth plumbing directly to the
underlying implementation?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]