java 到 scala 的转换 - r-tree 的通用类型丢失了吗?

java to scala conversion - generic typings for r-tree lost?

我想用https://github.com/davidmoten/rtree创建

RTree<String, Point> tree = RTree.create();
tree = tree.add("someStuff", Geometries.point(10,20));

在 scala 中我尝试了

val tree = RTree.create // note no generics here. Unsure how to add them
tree.add("someStuff", Geometries.point(10,20))

这导致 cannot resolve symbol 'add' when trying to compile the Scala code.

这应该可以解决问题:

val tree: RTree[String, Point] = RTree.create[String, Point]()
tree.add("someStuff", Geometries.point(10,20))