I've this class:
private class Item {
  private String transactionId;
  private String user;
  private LocalDate expiration;
  private String confidential;
  private String locked;
}
By other hand, I've five collections:
List<String> transactions;
List<String> users;
List<LocalDate> expirations;
List<String> confidential;
List<String> lockeds;
So I need to map each n of each collection to a new Item object.
Any ideas?
Stream over the indices (assuming all 5 lists have the same number of elements):
List<Item> items = IntStream.range(0,transactions.size())
                            .mapToObj(i -> new Item(transactions.get(i),
                                                    users.get(i),
                                                    expirations.get(i),
                                                    confidential.get(i),
                                                    lockeds.get(i)))
                            .collect(Collectors.toList());
                        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