Halsafar
Sep 28th, 2005, 05:32 PM
Now I find myself writing programs in Java and finding I hate the language.... Mostly the lacks of memory allocation, pointers, bitwise operations, dereference operator... So maybe someone can help me out here.
I need a container class which can store the reference of many objects of one type. Example:
class Asteroids <-- Simply Asteroid
class AsteroidContanier <-- A class to manage all asteroids via 1 array
Now, I think I must be missing something in this language because I cannot devise a way in my head to write my own array class similar to that of std::vector. Although I want to avoid writing my own array class and hopefully be told there is one within the Java Libraries. However I would like to know how it works.
See I need to be able to push() and pop()... Is this possible...
So my question becomes?
- How can I dynamically resize an array at runtime?
- Any recommended readings on this topic for Java?
I need a container class which can store the reference of many objects of one type. Example:
class Asteroids <-- Simply Asteroid
class AsteroidContanier <-- A class to manage all asteroids via 1 array
Now, I think I must be missing something in this language because I cannot devise a way in my head to write my own array class similar to that of std::vector. Although I want to avoid writing my own array class and hopefully be told there is one within the Java Libraries. However I would like to know how it works.
See I need to be able to push() and pop()... Is this possible...
So my question becomes?
- How can I dynamically resize an array at runtime?
- Any recommended readings on this topic for Java?