File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Compare string content in 2 vectors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compare string content in 2 vectors" Watch "Compare string content in 2 vectors" New topic

Compare string content in 2 vectors

Vince Hon
Ranch Hand

Joined: Feb 11, 2003
Posts: 117
I have 2 vectors with the same elements:
vector1 { ID, name, phone }
vector2 { ID, name, phone }
and 1 vector which conisists of both elementS from vector1 and vector2
vector3 {ID1, ID2, name, phone1, phone2}
I want to find if the element "name" in these vector1 and vector2 are equal
if vector 1 contain an element:
ID[1], name[Grace], phone[12345]
and vector 2 also contain an element:
ID[4], name[Grace], phone[99999]
I will add a new element in vector3, i.e.
ID[1], ID[2], name[Grace], phone[12345], phone[99999].
Are there any function in vector can do these in an more effiecient way ?

Vince Hon<br /> <br />SCJP 1.4 | SCWCD | SCBCD <br /><a href="" target="_blank" rel="nofollow"></a>
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
I agree. Here's the link:
subject: Compare string content in 2 vectors
It's not a secret anymore!