Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Union of two strings

807569Sep 11 2006 — edited Sep 11 2006
hello ,

string 1="abcdefgh"
string 2 ="acdefl"
the Union ="abcdefghl"

I did wrote a program that make a union of two strings but it is really slow when i have a tables contains thousends of strings.

here part of my code

h=0;
for (int t = 0; t < vectorUnion.size(); t++) {
if (threeGramString.equalsIgnoreCase
(vectorUnion.elementAt(t) .toString()))
h = 1;
}
if (h == 0)
vectorUnion.addElement(threeGramString);

the problem this way is slow, is it any class does that in java or any other idea

thnak you in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 9 2006
Added on Sep 11 2006
15 comments
238 views