generics issue

Wondering if someone can help me out with this...I am getting the format from another class which has similar structure from what I want my VectorBag to be...

Having issues with "The type E is not generic; it cannot be parameterized with arguments <E>" which is pointing at "public VectorBag(E<E> c)" If I take the <E> out it still errors with "The constructor Vector(E) is undefined"

import java.util.Vector;

publicclass VectorBag<E>extends Vector{

public VectorBag(){

super();

}

public VectorBag(E<E> c){

super(c);

}

Message was edited by:

Devin

[1047 byte] By [Devina] at [2007-11-26 22:28:31]
# 1

This makes no sense

E<E>

because E may be substituted by any type. Second, if you look at the Vector API, there is no constructor that takes a single element as a parameter. Hence the second error. In addition, modify your class signature to

public class VectorBag<E> extends Vector<E>

to make it explicit that you're extending a generic class. Have a look at the generics tutorial for more info http://java.sun.com/docs/books/tutorial/java/generics/index.html

#

duckbilla at 2007-7-10 11:31:43 > top of Java-index,Java Essentials,New To Java...
# 2
ah thank you very much. taking a look through that stuff now
Devina at 2007-7-10 11:31:43 > top of Java-index,Java Essentials,New To Java...