I want to implement KD tree. I have defined class nodeNode as follows:
Then I have defined class KDTreeKDTree in which I want to implement method contains(Node t)contains(Node t):
My question is doDo I need to use generics in class KDTreeKDTree? ImI'm not aware of when it is a good practice to use generics and when it is not? It would be nice, if someone can recommend me an article on when we have to use generics and when we don't have to.
EDIT: and also asAs far as I read the declaration public static class KDTree<T extends Node> means "class KDTreeKDTree contains objects that extends type Node". Is there any way to declare that class KDTreeKDTree contains only objects of type Node?
EDIT: class NodeClass Node represents a point in the plane, given by its x and y coordinate. Class KDTreeKDTree is a tree-structure that stores the points in such a way that it is easy to answer queries of the type: give me mm nearest points to my point p(x1, y1)p(x1, y1). This is the method that I use to construct KDTreeKDTree: