- Jul 18, 2002
- 1,655
- 1
- 81
Here s my problem.
I have 2 vectors. myVector and temp.
If myVector is empty or equal to null I just want to copy the value of temp into it.
If myVector is not empty then I want to append temp to it.
Here is my code:
if (myVector == null){
myVector = DocParser1.getVector();
System.out.println("Vector equals null" + myVector);
}
else {
myVector.addAll(temp);
System.out.println("Vector does not equal null" + myVector);
}
The code works fine when myVector is equal to null.
But if I add this line of code..
myVector.add(0,"HELLO");
Before the block if statement then nothing happens. Even the println statement does not execute.
I have tried the isEmpty function.
Any ideas?
I have 2 vectors. myVector and temp.
If myVector is empty or equal to null I just want to copy the value of temp into it.
If myVector is not empty then I want to append temp to it.
Here is my code:
if (myVector == null){
myVector = DocParser1.getVector();
System.out.println("Vector equals null" + myVector);
}
else {
myVector.addAll(temp);
System.out.println("Vector does not equal null" + myVector);
}
The code works fine when myVector is equal to null.
But if I add this line of code..
myVector.add(0,"HELLO");
Before the block if statement then nothing happens. Even the println statement does not execute.
I have tried the isEmpty function.
Any ideas?
