I want to achieve the following.
I have a general class Node<K,T,V>that looks like this:
public class Node<K,T,V>{
public K getKey() {
return key;
}
public void setKey(K key) {
this.key = key;
}
Now I want to have a class Treethat works with nodes with arbitrary parameterized types:
public class Tree <Node<K,V,T>> {
public void insert(Node<K,V,T> node){
K key = node.getKey();
}
}
This, however, does not work, as Eclipse tells me that the line public class Tree <Node<K,V,T>>does not look very good :) If I change it to
public class Tree <Node> {
He tells me that the type of Node hides the type of Node. How can I achieve this from the Tree class, can I refer to types K, V and T correctly?
I am sure that basillions have answered this question once. However, I did not find anything - sorry for that !!!
Greetings.
source
share