Computer Science Canada how do i delete a part of an array |
Author: | Genisis [ 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? |
Author: | Tony [ Thu Jun 15, 2006 10:59 pm ] |
Post 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. |
Author: | wtd [ Fri Jun 16, 2006 6:59 am ] |
Post 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. |
Author: | gsquare567 [ Fri Jun 16, 2006 1:40 pm ] |
Post 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. |