|
It depends on the access. If you access by ordinal position, then leaving something a Vector is "okay", except that you always have to cast it. I usually start with Vectors for those kind of collections, and then eventually replace the Vectors with my own class (I keep waiting for Java to support typed Vectors as an integral part of the language). So, iscmControlList is probably okay to leave as a Vector for now. However, what iscmControlList returns (let's call it FieldRow) is a collection of FieldDefinitions that you have to access by key. This is definitely NOT a Vector. In fact, you may want to consider subclassing Hashtable instead of Vector, because Hashtables provide keyed access. In any case, the code that you have in FieldFormatter that pulls an individual FieldDefinition out of a FieldRow definitely has no business in FieldFormatter, it should instead be a method in FieldRow. HTH ---------- Original Message ---------------------------------- From: "Stone, Brad V (TC)" <bvstone@taylorcorp.com> Reply-To: JAVA400-L@midrange.com Date: Fri, 16 Mar 2001 12:18:51 -0600 >sendID =iscmControlList.getRecord(i).getField("SND_ID").data(); Using this (which makes sense) my getRecord method for icsmControlList will have to return something other than a vector object, right? I'd have to make my own class (FieldRow or something) that it would return. Then write my own getField method for the FieldRow class. But in this case, FieldRow is nothing more than a vector (or fields). So is there an advatange to this, or is this just not right to begin with? (My comparable code) sendID = FieldListFormatter.getField((Vector)icsmControlList.get(i),"SND_ID").data; +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +--- +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.