How do I transform the following into a Lambda code?
The idea is to multiply maxScore
by i
so that with each interaction it raises the number, only for the first 5 results.
for(int i=0;i<5;i++){
list.get(i).setScore(maxScore + (0.01d * i));
}
The idea of the code is more or less this:
List<HashObject> list = createObjects(10);
Double maxScore = 0.9d;
for(int i=0;i<5;i++){
list.get(i).setScore(maxScore + (0.01d * i));
}
HashObject class:
public class HashObject {
private Integer id;
private String name;
private Double score;
/* Getters and Setters */
}