This is a portion of the string
471 pfm9254-disk01_01 0 io_grp0 online 3 Chassis2_IBMi 100.00GB striped 0 fcmap0 60050768028080EF6400000000001391 1 1 empty 0 no 0
472 IP10-32-41-70_SLES11SP2_10G 0 io_grp0 online 0 pfm3079_pfm3128 10.00GB striped 60050768028080EF64000000000007CE 0 1 empty 0 no 0
473 pfm3128_pva1091_stgvios1 0 io_grp0 online 1 VIOS_StgPool 35.00GB striped 60050768028080EF64000000000007D1 0 1 not_empty 0 no 0
474 vdisk64 0 io_grp0 online 13 pfm9253_pfm9254_new 9.94GB striped 60050768028080EF6400000000001CC4 0 1 empty 0 no 0
475 vdisk65 0 io_grp0 online 13 pfm9253_pfm9254_new 10.00GB striped 60050768028080EF6400000000001CC6 0 1 empty 0 no 0
I want to check whether it contains any members of my arrayList
I know I can iterate over the arrayList and then check for each element whether the string contains the element. I am looking for an efficient solution
This is my ArrayList
ArrayList<String> volIDsSent = new ArrayList<String>();
volIDsSent.add("60050768028080EF6400000000000AC3");
volIDsSent.add("60050768028080EF6400000000000FF8");
I would get the string from somewhere line by line .
Consider reading the array once and building a regex string by concatenating with “|” between each one, either manually or with something like StringUtils.join. Then use the regex against each line to read.