This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Adding 2 vectors  RSS feed

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 vectors and i have to place the content of 2 vectors in to another vector.
Vector v1= getting data from database and placing that in this
Vector v2= getting data from db
Vector v3 = new Vector();
v3.add(v1);
v3.add(v2);
But this is not working
Can any one plz help me
 
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to use the addAll() method, to put the *content* of a Collection into a Vector. The add() method puts the Collection itself in.

Unless you are using legacy code that forces you to use Vector, you should never use Vector. Use ArrayList, LinkedList or some other modern implementation of List.

A bartender will shortly be complaining about your obviously-false display name. Do yourself a favour and put in a real (sounding) one, before they do.

Lastly, this is not an advanced issue. Wrong forum.
[ April 04, 2006: Message edited by: Peter Chase ]
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!