creating Objects: how to have n objects?
Author |
Message |
turboliux
|
Posted: Wed Jan 04, 2006 3:30 pm Post subject: creating Objects: how to have n objects? |
|
|
ok, i m doing this program dossier thing where i need to create my own program. so i decided to have a organizer, maybe some kind of KOrganizer (KDE, Linux) but simplified. well i pretty much know how it gonna look like (GUI), but i dont know how to its gonna work, how it should be designed. so i'm stuck with system design.
...so far i know what i will have Linked List with Nodes. each node will have an object and a reference to next object. and this object i will call "Row". Row will have different information:
code: | | year | month | day | noteID | note |
--------------------------------------------------------
row1 | 2005 | Janua | 03 | 01 | need to buy... |
row2 | 2005 | Janua | 04 | 02 | meet John tmrw at... | |
the trick is that the user makes as many notes as he wants. so i cannot make objects for him, there can be 'n' objects. is there a method in java where, when you have lets say code: | Row row1;
Row row2;
//and then user clicks on the button or clicks on the text field, etc.
Row row3; |
how to allow the user create new object? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Wed Jan 04, 2006 4:53 pm Post subject: (No subject) |
|
|
An ArrayList perhaps. |
|
|
|
|
|
turboliux
|
Posted: Thu Jan 05, 2006 5:19 am Post subject: (No subject) |
|
|
so each time the user enters new note, he adds new object to list? code: | ArrayList list = new ArrayList();
//when user enters new note:
list.add(new Row(foobar)); | .... so is it an array or list? kinda confused |
|
|
|
|
|
turboliux
|
Posted: Thu Jan 05, 2006 6:01 am Post subject: (No subject) |
|
|
whats the difference between LinkedList and ArrayList?
and also, in requirements it says:
"ADT name: Lists, implemented using references (that is, a dynamically linked list)." |
|
|
|
|
|
Andy
|
Posted: Thu Jan 05, 2006 11:36 am Post subject: (No subject) |
|
|
yea i tihnk they want u to impliment the list ADT using linked lists, its not too bad... a doubly linked list would work just fine for your situation |
|
|
|
|
|
|
|