I'm not sure if i'm going mad or stupid but as far as i can rely
on my eyes, when i ADD an element to a Vector, it gets put on
ALL the position, instead of the last one. It's like if it rolls all
the way down the list leaving its footprints along the way.
I wrote, like:
import java.util.*;
public class Temp {
public static void main (String[] arg) {
Vector vec = new Vector ();
String[] outPutLine = new String[3];
String line;
for (int k = 0; k < 4; k++) {
for (int i = 0; i < outPutLine.leng th; i++)
outPutLine[i] = "S(" + i + ";" + k + ")";
vec.add (outPutLine);
System.out.prin tln ("outPutLine " + k + " is: \t\t" + outPutLine[0] +
"\t" + outPutLine[1] + "\t" + outPutLine[2]);
System.out.prin tln ("The result is:");
String test = "";
for (int i = 0; i < vec.size (); i++) {
for (int j = 0; j < 3; j++)
test += ((String[])vec.get (i))[j];
test += "\n";
}
System.out.prin tln (test + "\n---------------------------------\n");
}
}
}
So, is it just me or is there funky with the output? Where did the
element S(0;0) go, for instance?!
--
Kindly
Konrad
---------------------------------------------------
May all spammers die an agonizing death; have no burial places;
their souls be chased by demons in Gehenna from one room to
another for all eternity and more.
Sleep - thing used by ineffective people
as a substitute for coffee
Ambition - a poor excuse for not having
enough sense to be lazy
---------------------------------------------------
on my eyes, when i ADD an element to a Vector, it gets put on
ALL the position, instead of the last one. It's like if it rolls all
the way down the list leaving its footprints along the way.
I wrote, like:
import java.util.*;
public class Temp {
public static void main (String[] arg) {
Vector vec = new Vector ();
String[] outPutLine = new String[3];
String line;
for (int k = 0; k < 4; k++) {
for (int i = 0; i < outPutLine.leng th; i++)
outPutLine[i] = "S(" + i + ";" + k + ")";
vec.add (outPutLine);
System.out.prin tln ("outPutLine " + k + " is: \t\t" + outPutLine[0] +
"\t" + outPutLine[1] + "\t" + outPutLine[2]);
System.out.prin tln ("The result is:");
String test = "";
for (int i = 0; i < vec.size (); i++) {
for (int j = 0; j < 3; j++)
test += ((String[])vec.get (i))[j];
test += "\n";
}
System.out.prin tln (test + "\n---------------------------------\n");
}
}
}
So, is it just me or is there funky with the output? Where did the
element S(0;0) go, for instance?!
--
Kindly
Konrad
---------------------------------------------------
May all spammers die an agonizing death; have no burial places;
their souls be chased by demons in Gehenna from one room to
another for all eternity and more.
Sleep - thing used by ineffective people
as a substitute for coffee
Ambition - a poor excuse for not having
enough sense to be lazy
---------------------------------------------------
Comment