Hi, I am implementing the readRecord(), deleteRecord(), and updateRecord()from DBAccess.java interace. The Supplied recNo paramter to these methods is supposed to be a long.
However, I have read all my records into an ArrayList, and there is a delete and read methods on the ArrayList class that take int. Can I cast the long to an int and risk losing data if the long is greater than an int value?
Sham: I thought about doing it that way at first, then I changed my mind. They made the recNo long for a reason. So when ever I traverse through my arrayList, I just keep going until I find the element whose long recNo matches the long recNo passed into the method! I don't assume any special relationship between the index of the arrayList and the recNo of the subcontractor element.
I hope this helps. --Bob
Bob N
CSSLP
SCJP - 1.4
SCJD - (B&S) Used 1.5 And It Runs On Solaris10
SCWCD - Thanks to HFSJ!!
I assume Sham's implementation caches all records in an ArrayList, each one in it's position, even deleted ones. So if you want record 15, you just do list.get(15). I'm not saying it is good or bad, though.