i need some help with a java code,
This is my code:
public void showData() {
int pass = 0;
/* For first list */
for(int i = 0; i < first_list.length; i++) {
if(first_list[pass].toString() != second_list[i].toString()) {
System.out.println(first_list[i]);
} else {
}
}
pass++;
}
The output:
- Porto
- Algarve
But i dont want this and i understand that by doing this way, my for ends and dont do other passes.. i want to get all possible combinations without repeat words, the output that i want is this one:
- Porto
- Algarve
- Lisboa
- Algarve
- Lisboa
- Porto
This is a draw to help understand:
How can i do such thing? Thank you!
EDIT: Im not asking how to compare strings... if someone can point me a topic with what i want, it would be nice, if not.. well some advices would be great