This content has been marked as final. Show 6 replies
you don't need "CRdbSize", that is the same as CRdb.length, except that you forgot to update "CRdbSize", and then you compare with it later, so everything breaks
I suggest that you use an ArrayList<CallRecordInfo> instead of an array; it automatically expands, and adding is guaranteed to be efficient (amortized constant time). Adding is also easy with the .add() method.
As an added bonus, if you really need an array at the end, you can
final CallRecordInfo array = new CallRecordInfo[myList.size()]; (CallRecordInfo) myArrayList.toArray(array);
you know there are already dynamic array-like classes in the jdk, right?
hi, thank you everyone for helping me out. I never noticed that I forgot to update "CRdbSize", how silly! ... However, I was wondering about the ArrayList that you suggested. How would I initialise it?
If i write something like
Then I get all sorts of errors. I'm sorry for the dumb question, I'm just not use to ArrayList as yet. :( ..
ArrayList <CallRecordInfo> db = new ArrayList();
List<CallRecordInfo> db = new ArrayList<CallRecordInfo>();