How can I convert Array of Strings into Boolean ArrayList in Java?
For ex: I have String Array like this:
String[] strs= {"true","false","false","true",..etc};
Now, I want all of the above values into a Boolean ArrayList.
List<Boolean> bools=[true, false, false, true, ..etc]
I can do something like this below, but I want this task to be accomplished in one single line of code.
String[] strs={"true","false","false","true",..etc};
List<Boolean> bools=new ArrayList<Boolean>();
for(String x:strs)
bools.add(Boolean.parseBoolean(x));