I have two lists as below:
List ids = Arrays.asList(1,2,3); List reps = Arrays.asList("abc","pqr","xyz");
Now I want to create list of Prediction objects with values mapped from above two lists in sequence like below:
List results = [ Prediction(1,"abc") , Prediction(2,"pqr"), Prediction(3,"xyz") ]
class Prediction {
int id;
String rep;
}
How this can be done using Java8 Stream API.