I have the following lists:
List<Token> originals
List<Token> modified
The Token class is as follows:
class Token
{
private String value;
private String rawValue;
}
I want to replace the rawValue
of all the Token
objects in originals
, with the rawValue
of the Token
object at the corresponding index in modified
. Both the lists are guaranteed to be equal in length.
Here is the pseudocode:
for i in originals.length
originals[i].rawValue = modified[i].rawValue
Is there a way to do this using Stream? Or is using a For loop simpler and more readable here?