J
Jan Biel
Hi there!
I've got a little problem:
I take an empty Vector
Vector test = new Vector();
and two Arrays with the same contents:
int a[] = {1,2};
int b[] = {1,2};
Now I add one Array to the Vector:
test.add(a);
and test whether the second Array is in the Vector:
if (test.contains(b))
System.out.println("yep!");
Of course the result is that Array b is not in the Vector, since although it
contains the same values as a, it bears a different signature.
My question: How can I implement a way of finding arrays with same values in
the Vector. My goal is to implement a Vector with many one dimensional
Arrays containing two values (like above). A new Array will only be added if
there's no Array with the same values in the array.
Is that possible?
Thanks a lot in advance,
Janbiel
PS: Source code in one piece:
Vector test = new Vector();
int a[] = {1,2};
int b[] = {1,2};
test.add(a);
if (test.contains(b))
System.out.println("ist drin");
I've got a little problem:
I take an empty Vector
Vector test = new Vector();
and two Arrays with the same contents:
int a[] = {1,2};
int b[] = {1,2};
Now I add one Array to the Vector:
test.add(a);
and test whether the second Array is in the Vector:
if (test.contains(b))
System.out.println("yep!");
Of course the result is that Array b is not in the Vector, since although it
contains the same values as a, it bears a different signature.
My question: How can I implement a way of finding arrays with same values in
the Vector. My goal is to implement a Vector with many one dimensional
Arrays containing two values (like above). A new Array will only be added if
there's no Array with the same values in the array.
Is that possible?
Thanks a lot in advance,
Janbiel
PS: Source code in one piece:
Vector test = new Vector();
int a[] = {1,2};
int b[] = {1,2};
test.add(a);
if (test.contains(b))
System.out.println("ist drin");