I have started studying trees in java. I have found an interface for tree that is in code below:
public interface Tree<E> {
public int size();
public boolean isEmpty();
public Iterator<E> iterator();
public Iterable<Position<E>> positions();
public E replace(Position<E> v, E e)
public Position<E> root();
public Position<E> parent(Position<E> v);
public Iterable<Position<E>> children(Position<E> v);
public boolean islnternal(Position<E> v);
public boolean isExternal(Position<E> v);
public boolean isRoot(Position<E> v);
}
when I write this cod with these imports:
import java.util.Iterator;
import javax.swing.text.Position;
I face with this Error : type position does not take parameter
I can't understand what should I do to have this tree interface to be generic. can any one please help me?? thanks in advance for your attention
Positionis not defined to be generic.Positionis declared generic in some other package and you have used the wrong import statement wherePositionis not defined to be generic.