what can i use instead of generics?

I have a peice of code which i am getting loads of problems with the only thing i can think of is that i am using generics, can somebody tell me another way to write this without using generics?List<VidBean> videos = new ArrayList<VidBean>();
[268 byte] By [eastendersa] at [2007-11-27 0:27:52]
# 1

> I have a peice of code which i am getting loads of

> problems with the only thing i can think of is that i

> am using generics, can somebody tell me another way

> to write this without using generics?

>

> List<VidBean> videos = new ArrayList<VidBean>();

What is the problem exactly? Does it complain about VidBean not being found?

snic.snaca at 2007-7-11 22:28:13 > top of Java-index,Java Essentials,Java Programming...
# 2

it says:

List<VidBean> videos = new ArrayList<VidBean>(); /// can i put this as a array whats <> for?

^

1 error

Errors compiling finderBean.

but i would rather chnage it so it doe not use generics, can anybody tell me what the alternative is?

eastendersa at 2007-7-11 22:28:13 > top of Java-index,Java Essentials,Java Programming...
# 3
List videos = new ArrayList();
prometheuzza at 2007-7-11 22:28:13 > top of Java-index,Java Essentials,Java Programming...
# 4
What is the error msg? code seems fine.
rohit_dixita at 2007-7-11 22:28:13 > top of Java-index,Java Essentials,Java Programming...
# 5
List videos = new ArrayList();Is that the alternatvie to use?
eastendersa at 2007-7-11 22:28:13 > top of Java-index,Java Essentials,Java Programming...
# 6
> List videos = new ArrayList();> > Is that the alternatvie to use?That's what I suggested. Have you tried it?
prometheuzza at 2007-7-11 22:28:13 > top of Java-index,Java Essentials,Java Programming...
# 7

yeah i tried that but now instead of the error from above i get 6 errors:

myBean.java [38:1] cannot resolve symbol

symbol : method forName (java.lang.String)

location: class Class

Class.forName("com.mysql.jdbc.Driver").newInstance();

^

myBean.java [71:1] incompatible types

found: java.util.ArrayList

required: List

List videos = new ArrayList();

^

myBean.java [73:1] cannot resolve symbol

symbol : class VidBean

location: class finderBean

VidBean video = new VidBean();

^

myBean.java [73:1] cannot resolve symbol

symbol : class VidBean

location: class finderBean

VidBean video = new VidBean();

^

myBean.java [74:1] cannot resolve symbol

symbol : method getInd (java.lang.String)

location: interface java.sql.ResultSet

video.setRecId(rs0.getInd("recording_id"));

^

myBean.java [86:1] cannot resolve symbol

symbol : variable stmt

location: class finderBean

stmt.close();

^

6 errors

Errors compiling myBean.

eastendersa at 2007-7-11 22:28:13 > top of Java-index,Java Essentials,Java Programming...
# 8

I have managed to get rid of some of those errors but am left with these ones. Ifi i change listvids = new arraylist() to just a list that error goes away but having not used lists before i do not know if that is correct or not.

myBean.java [38:1] cannot resolve symbol

symbol : method forName (java.lang.String)

location: class Class

Class.forName("com.mysql.jdbc.Driver").newInstance();

^

myBean.java [76:1] incompatible types

found: java.util.ArrayList

required: List

List vids = new ArrayList(); // use this instead i think // works if i put it as list not array list

^

myBean.java [96:1] cannot resolve symbol

symbol : variable stmt0

location: class myBean

stmt0.close();

^

3 errors

Errors compiling myBean.

I have now got rid of two of those errors and i am just left with :

mysite/myBean.java:96: cannot resolve symbol

symbol : variable stmt

location: class mysite.myBean

stmt.close();

^

1 error

can anybody see whats up with it?

Message was edited by:

eastenders

eastendersa at 2007-7-11 22:28:13 > top of Java-index,Java Essentials,Java Programming...
# 9
Did you declare your own classes whose names are Class and List?
DrClapa at 2007-7-11 22:28:13 > top of Java-index,Java Essentials,Java Programming...
# 10

sorry i don't quite understand that i dont have a class file called calss or list if thats what you mean, the only error i get now is:

mysite/myBean.java:96: cannot resolve symbol

symbol : variable stmt

location: class mysite.myBean

stmt.close();

^

1 error

Problem solved, i put the stmt.close() in the wrong place i put it after the catch!

Message was edited by:

eastenders

eastendersa at 2007-7-11 22:28:13 > top of Java-index,Java Essentials,Java Programming...