I have a method getPosition(String ignoreText) which is called from other methods.
I want to store the value of ignoreText at every invocation method getPosition in a vector
For e.g.: if getPosition is called this way
Then the vector should contain the values Test1, Test2, Test3
I have tried with the following code snippet, however the temp vector stores only the current value of ignoreText.
Please let me know how to do this.
Joined: Oct 13, 2005
Why are you declaring an Exception from that method? Why are you using Vector at all? There are better List implementations, eg ArrayList. Why does your method not return anything? Why would you want your method to return anything? Why are you using an ordinary for loop? Your method name looks very peculiar, and does not appear to reflect what the method does.
How are you invoking that method? Which object are you invoking the getPosition() call on?
Aside from the other issues that Campbell pointed out, my guess is that the reason you only get back whatever you passed for ignoreText is that you don't have a static invocation of your object. Without seeing how you are calling the object, it would seem that you are creating a new Vector each time you call so you're only getting back the latest new Vector and its content any time you call this method (just a guess).
Joined: Nov 03, 2006
Yes, i figured out the problem. After i declared the vector as static my issue was resolved.