× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



    Hi Ron,

    As Franco indicated, you can put any Object in a Vector, and get the
effect of Vectors of Vectors of...  But this statement is a little confusing
to me:

> I have a Property object that I'd like to put in a vProp vector that
> is located in an index of the vStreet vector?

    I often use what I call corresponding arrays - for a quick and probably
bad example, arrays of client id and client name, where each element refers
to the same client.  You could do a similar thing with Vectors.  One issue
though, is that when items are removed from a collection, including Vectors,
the index changes, so you have to be careful that all associated vectors are
in synch.

    I don't know your app, so this make not make sense in context, but an
approach I'd prefer would be to have a subclass of Street ( or add to the
existing class ) in which each instance contains a reference to the
appropriate Property Vector.  Then you don't have to worry further about
correspondence.

    In later versions of the JVM, synchronization in Vectors is not such a
big deal, but, unless synchronization is required, it's curious at this
stage why anyone would not prefer a newer collection.


                                                         Joe Sam

Joe Sam Shirah -        http://www.conceptgo.com
conceptGO       -        Consulting/Development/Outsourcing
Java Filter Forum:       http://www.ibm.com/developerworks/java/
Just the JDBC FAQs: http://www.jguru.com/faq/JDBC
Going International?    http://www.jguru.com/faq/I18N
Que Java400?            http://www.jguru.com/faq/Java400


----- Original Message ----- 
From: <RPower@xxxxxxxxxx>
To: "Java Programming on and around the iSeries / AS400"
<java400-l@xxxxxxxxxxxx>
Sent: Monday, March 28, 2005 2:30 PM
Subject: Vector of a vector?


> Can I do a 2 dim vector?
>
> What I have is a list of streets, and for each street there is a list of
> propertys.  I have a street object that I'm putting in a vStreet vector
> now.  I have a Property object that I'd like to put in a vProp vector that
> is located in an index of the vStreet vector?  Any ideas?  I know
> ArrayList is better, but I was told to use a Vector :(
>
> Ron Power
> Programmer
> Information Services
> City Of St. John's, NL
> P.O. Box 908
> St. John's, NL
> A1C 5M2
> Tel: 709-576-8132
> Email: rpower@xxxxxxxxxx
> Website: http://www.stjohns.ca/
>


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.