You should break out of the loop once you have found a match, and print the result outside the loop, as shown below: boolean match = false ; for(int I = 0; I Print(match) Alternatively, a shorter approach is to not use a loop but call the contains method of the list instead: boolean match = aList. Contains("Red"); System.out. Println(match).
You should break out of the loop once you have found a match, and print the result outside the loop, as shown below: boolean match = false ; for(int I = 0; I Print(match); Alternatively, a shorter approach is to not use a loop but call the contains method of the list instead: boolean match = aList. Contains("Red"); System.out. Println(match).
Thanks! Your are awesome! – Guo Xiuhao Feb 2 at 12:53.
Contains should do the trick if (aList. Contains("Red")) { //cool }.
I have a problem with matching a string against a string arraylist and getting a single boolean result. Basically, I used a for loop to do the matching and all I get was a series of boolean. But what I want is that when there is one amongst all the boolean, it will return one single value and if it is all , then it will return a single value.
The code is as below.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.