I want to create a query if the getData()
return "yes"
. So added the filter for the same.
Now if the value of getData()
is "yes"
then I want to concat the three parameter which I am getting from the object.
Now for the list of object I want to join all the value which is coming from
(f -> f.getF()+" "+f.getO()+" "+f.getV())
with " and " as delimiter but not able to figure it out.
String query = data.stream()
.filter(f -> f.getData().equalsIgnoreCase("yes"))
.map(f -> f.getF()+" "+f.getO()+" "+f.getV())
.collect(Collectors.joining(" and","how to do this" , suffix));
for example, we are getting data from that object as
f.getF()--------"column name"
f.getO()--------"="
f.getV()--------"2"
so I want to add all the condition with and delimiter and produce a single String with all the conditions.
I think I can append "and" in the map() and later remove the last "and" from the string
something like this
columnname = 2 and columnnam1 > 1 and column2 = 6