I am iterating over a vector of string as:
for(String s : st){
while(s.equals("a")) //just an example, not exactly this required
{
//go to next element : How to do this?
}
System.out.println(s);
}
How to iterate over next elements within the for(:) loop?
EDIT:
As many asked the logic of while,
the vector of string is basically containing single words of a sentence and I have to collapse Noun Phrases in the sentence, e.g. if there is a sentence like "Robert Sigwick is going home". so right now st[0] has "Robert" and st[1] has "Sigwick". After the processing I have to make st[0] = "Robert Sigwick".
So my code is somewhat like:
for(String s : st){
string newEntry = "";
while(getPOS(s).equals("NNP"))
{
newEntry += s;
// HERE I WANT THE HELP : something like s = getNext();
}
if(!newEntry.equals(""))
result.add(newEntry);
}