Author |
Message |
Genisis
|
Posted: Thu Jun 15, 2006 8:57 pm Post subject: how do i delete a part of an array |
|
|
dont know how to delete part of an array and one of the options of my program is that the use can choose to delete a record how do i do that? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Thu Jun 15, 2006 10:59 pm Post subject: (No subject) |
|
|
Usually the record that needs to be deleted is swaped with the last record in the array, and then cut via reducing array's size by one. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
wtd
|
Posted: Fri Jun 16, 2006 6:59 am Post subject: (No subject) |
|
|
Your best bet if you need to do something like this is to use not an array at all, but rather one of Java's Collection classes. Perhaps ArrayList. |
|
|
|
|
|
gsquare567
|
Posted: Fri Jun 16, 2006 1:40 pm Post subject: (No subject) |
|
|
yeah theres the ArrayList class and also the LinkedList class... they're quite similar but it depends on what you're doing if you want the better choice for you. |
|
|
|
|
|
|