locationtech / jts

The JTS Topology Suite is a Java library for creating and manipulating vector geometry.
Other
1.99k stars 443 forks source link

Use generics for index classes? #146

Open dbaston opened 7 years ago

dbaston commented 7 years ago

What do people think about updating some of the index classes to use generics? It would be nice to not cast the return values from spatial index queries, etc.

dr-jts commented 7 years ago

Possible reasons to NOT do this are:

bjornharrtell commented 7 years ago

May require some work on the transpilation but should not be too hard to fix.

jnh5y commented 7 years ago

Generally, I'm interested in seeing JTS attract folks who work on optimizing spatial indices. As an option for JTS 1.x, could we experiment with this in a JTS-indexing-labs package?

dr-jts commented 5 years ago

This would break current API, wouldn't it? I.e. would require classes to be instantiated specifying the contained type?

Or is it possible to make the generic type optional (but seems unlikely...)?

dbaston commented 5 years ago

I thought it just defaulted to Object if you omitted it.

dr-jts commented 5 years ago

I thought it just defaulted to Object if you omitted it.

If so, that would be awesomely awesome! And indeed it appears you may be right: http://www.angelikalanger.com/GenericsFAQ/FAQSections/ParameterizedTypes.html#FAQ201