I wanted to optimize the below code. Will streams optimize the below nested foreach loops? If so am new to streams can someone please help me? In the below I have replaced the names for project confidentiality purpose. Shall be using the tList for further processing in the code. Can some one please help on this?
List<Tea> tea = requestBody.getTea();
for (Tea tea1 : teas) {
List<String> teaValues = tea1.getTeaValues();
for (String t : teaValues) {
if ((t).contains("tMapping") || ((t).contains("tdata"))) {
int subStrng = t.indexOf(".") + 1;
int subStrngSpace = t.indexOf(" ");
String tStrng = t.substring(subStrng, subStrngSpace);
tList.add(tStrng);
} else {
String[] tStrng = t.split("\'");
String t1 = tStrng[1];
tList.add(t1);
}
}
}