I am trying to compare the list of 100 records should have either "true" or false or null .
I have taken all the value of the list in Array which have 100 records with value for e.g [0]-true ,[1]-true,[2]-false, ... and so on.
Now i want to create a method to compare the list of values should atleast have any one of the three values i.e. either true,false or null. If this condition is satisfied then the method should return true.
and if all the list of values are false then the it should return false.
But the method i have created always check the first index value .
Here the list is having string values in it .Could someone please help me to get this assignment done . Thank you
public boolean isAllRecordsAreValid (String []list) {
boolean ret= false;
for (int i=0;i<list.length; i++){
if ( list[i].equals("true")&& list[i].equals(null)&&list.equals("false")){
return false ;
}
return true;
}
return ret;
}
Aucun commentaire:
Enregistrer un commentaire