File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes implement own ArrayList  ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "implement own ArrayList  ?" Watch "implement own ArrayList  ?" New topic
Author

implement own ArrayList ?

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1381
How can i implement my own ArrayList instead of using java.util.ArrayList ?
Timmy Marks
Ranch Hand

Joined: Dec 01, 2003
Posts: 226
What problem are you having? If you're just looking for source code for it, you might as well use the source from Sun!
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
sounds like a homework assignment... Often those include things like "write your own <whatever>" even if such already exists.

Yes, you can write your own.


42
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
If your assignment is to create your own, start with the JavaDoc that describes it as "Resizable-array implementation of the List interface." Make an empty class that "implements List" and the compiler will tell you (in the form of error messages) what methods you need to write. Look at the doc for List to see what they all do. Some are optional and depending on your aassignment you may be able to throw UnsupportedOperation exception for any you don't get to.

It would proabably be cheating to extend AbstractList.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
wood burning stoves
 
subject: implement own ArrayList ?