Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 how do i delete a part of an array
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Genisis




PostPosted: 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
Sponsor
sponsor
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
wtd




PostPosted: 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




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: