02-16-2005, 04:15 PM
I've tried an ArrayList, and it's dynamic, but I can't make it multi-dimensional!
Is it possible to have an array of 2 dimensions that has the first dimension dynamic?
e.g. [x], [x] etc
02-16-2005, 05:00 PM
You could store arrays in the ArrayList, or make an array of ArrayLists (depending on which dimension needs to be dynamic).
02-16-2005, 05:06 PM
Yeh I would if I knew how...
02-16-2005, 06:28 PM
Are you dynamically trying to initialise the array?
When it comes to specific class use, the API specs (http://java.sun.com/j2se/1.5.0/docs/api/) are your best friend. Java is extremely well-documented, given that you know what you're looking for. I linked to the Java 1.5 documentation, but you can replace the 1.5.0 in the url with whatever version you're using (ie. 1.4.2).
What's with all the <E> and <T> stuff in the Collections framework now? I couldn't help but notice that ArrayList.get(int index) now returns something with a class of E and ArrayList.add() takes an argument of class E. Also, ArrayList.toArray() returns an array of objects with class T :confused:
02-16-2005, 06:58 PM
When it comes to specific class use, the
What's with all the <E> and <T> stuff in the Collections framework now?
Generics (like templates in C++).
Thanks, I found something on it -- http://www-106.ibm.com/developerworks/java/library/j-djc02113.html
It's pretty interesting :thumbsup:
02-16-2005, 07:56 PM
Here is another question. What is the easiest or quickest way to convert a negative integer to a positive integer?