I having a property file containing below data :
acqurierSystemAlias=CTC0,CTC1,CTC2,CTC3,CTC4,FEXCO,AMEX,DINERS
now in the main program :
String acqurierSA = "CTC1";
String[] acqurierSystemAlias = properties.getProperty("acqurierSystemAlias").split(",");
for(String xyz: acqurierSystemAlias){
if(xyz.equalsIgnoreCase(acqurierSA)) {
System.out.println("true");
} else {
System.out.println("false");
}
}
This is returning me : false, true, false, false, false
My requirement is just to return true if the acqurierSA is in the propertyfile or else return false, I want only a single value. Currently it is returning me the values in loop.
You could make a
listformArrayand then check withcontains()No need to traverse through the array.