i define an object:
tempRes = new Object[100000][7];
now after that i fill it up till 100 rows for example.
Now how to delete every object past that(from tempRes[100] too tempRes[10000]).
I need this for a JTable.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Honestly, don’t use an array if you don’t know how many items you will have to add. An array will reserve memory for the given size. Use a
Listor aVector, add your items, and convert it to an array later. Or do not convert it at all if your usage (JTable for example) can also work with Vectors.In addition, in case you have the data stored elsewhere in memory and the list is huge, implementing your own
TableModelsubclass (which is called dynamically when you scroll to the rows and you will have to build them on demand then) is a lot more efficient than rendering all your rows into an array first.Example for a List: