How can I update an item the arraylist using stream, example I want to update item 1 from 100 to 1000:
List<PayList> payList = new ArrayList<>();
payList.add(new PayList(1, 100));
payList.add(new PayList(2, 200));
I am able to find the index, but how can I find the index and then update the value?
int indexOf = IntStream.range(0, payList.size())
.filter(p -> trx.getTransactionId() ==
payList.get(p).getTransactionId())
.findFirst().orElse(-1);
setAmountto update 100 to 1000?