Results 1 to 4 of 4

Thread: Conditional add of vectors... **RESOLVED**

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2002
    Posts
    45

    Conditional add of vectors... **RESOLVED**

    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:
    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?
    Last edited by IwishIcouldprog; Dec 14th, 2003 at 03:10 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width