Single key with multiple values in property
java
Solution
You could make a `list` form `Array` and then check with `contains()`
String[] acqurierSystemAlias = properties.getProperty("acqurierSystemAlias").split(",");
List<String> lList=Arrays.asList(acqurierSystemAlias);
boolean found=lList.contains(acqurierSA );
System.out.println(found);
No need to traverse through the array.
Problem
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.