Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Errors with ArrayList? I'm drowning in confusion! *glug* *glug*

 
Adam Altmann
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

For the past week or so, I've been writing a program to transfer records from one database to another. I've been writing it with Eclipse, and can run it, and it works, and everything is just dandy.

HOWEVER, if I try to compile at the command line, I get the following Fun:



Now that I've been warned (seven times) and notes regarding my poor coding skillz have been appended to my Permanent Record, I'd like to fix Things. The problem is, of course, that I have no idea what's going on. I'm reading the API, trying to figure out where things have gone wrong in ArrayList and Collections counties, but am having no luck.

Here's the class in question:

 
Adam Altmann
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok...

I've managed to "fix" things and get warning-free compiling by adding <String> to the end of ArrayList statements here and there. This is a fantastic development and everything, but I'm still baffled as to why it happened in the first place?

Why did it compile and run fine in Eclipse, yet not cooperate with me at the command-line?

Strange things are afoot at the Circle K.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In eclipse, a Java-1.4 is specified as compiler, but in the path, you find a java-1.5 before java-1.4.

Java-generics where introduced with java5, aka java-1.5.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic