Dynamic Data Types in Eclipse

All righty. I'm fairly new to Java, but I've had extensive experience in PHP and C++. I forget the exact name for what I'm trying to do, but what it amounts to is this. Pretend you have a Linked List class and you dont want to specify what it's a list OF (at run-time you might want a list of strings or ints or chars or whatever). The way I was told I should do this was as follows:

where the <E> at the end of the class declaration signifies that you will tell it what data type you want later.

This is all well and good when I use a good, old-fashioned commandline compiler. When I put it into Eclipse, however, it underlines "Jeff<E>" in red and says "Syntax error on tokens, delete these tokens."

Does anyone know what would cause this, or how to fix it? As I say, the exact same code compiles fine using a command-line compiler.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus

Jeffmeme Wrightmeme
Greenhorn

Joined: Jan 14, 2005
Posts: 3

posted Jan 14, 2005 16:41:00

0

awesome, thanks. I'll go download that and see if that fixes my problem.

Thanks again.

Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112

posted Jan 14, 2005 17:09:00

0

You will also need to adjust the compliance setting of the Eclipse compiler, btw.

Jeffmeme Wrightmeme
Greenhorn

Joined: Jan 14, 2005
Posts: 3

posted Jan 14, 2005 19:52:00

0

How do I do that?

Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112

posted Jan 15, 2005 00:53:00

0

From memory it must be somewhere along the lines of "Windows/Preferences/Java/Compiler/Compliance".