Search code examples
javascalagenericsr-tree

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


I want to use https://github.com/davidmoten/rtree to create

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

In scala I tried to

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

This results in cannot resolve symbol 'add' when trying to compile the Scala code.


Solution

  • This should fix it:

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