aspose file tools*
The moose likes Java in General and the fly likes can I add Vectors together? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "can I add Vectors together? " Watch "can I add Vectors together? " New topic
Author

can I add Vectors together?

Zoe Peng
Ranch Hand

Joined: Nov 27, 2000
Posts: 112
Hi,
I have three vectors. My question is how can I make
addressVector is equal to all the cityVector+ stateVector?
I got convert Vector to int error.
Thanks.
Vector addressVector = this.getAddressList();
Vector cityVector = this.getCityList();
vector stateVector = this.getStateList();
public Vector getAddressList(){return addressList; }
public Vector getCity(){return cityList; }
public Vector getStateList(){return stateList; }
public void setAddressList(Vector arg) { addressList = arg; }
public void setCityList(Vector arg) { cityList = arg; }
public void setStateList(Vector arg) { stateList = arg; }

Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Zoe,
Have you tried addressVector.addAll( cityVector ) and then addressVector.addAll( stateVector ).
The method appends the added collection to the existing one. See the addAll() method in the API
Hope that helps.
[This message has been edited by Jane Griscti (edited November 08, 2001).]


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Zoe Peng
Ranch Hand

Joined: Nov 27, 2000
Posts: 112
Jane,
Thanks. I'll give it a try.
 
Consider Paul's rocket mass heater.
 
subject: can I add Vectors together?