I am new to java 8.
me want to use java8 and want to convert below to java8.
List<Model> listModel;
for (Model model : listModel)
{
try
{
new UpDateData().bankData(model.getCust_id(), model.getBank_id(), model.getDate());
}
catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
Model class::
public class Model
{
private int cust_id;
private int bank_id;
private String date;
//setter and getter
}
My question How me can apply java 8 features on above list, me want to iterate and call teh another function.
you could just use a forEach
:
listModel.forEach(model -> {
try {
new UpDateData().bankData(model.getCust_id(), model.getBank_id(), model.getDate());
} catch(){
.... handle
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With