-
Notifications
You must be signed in to change notification settings - Fork 111
TAJO-2058: foreach loop can be collapsed with stream api #944
base: master
Are you sure you want to change the base?
Conversation
for (PartitionSpecifier specifier : specifiers) { | ||
hash.specifiers.add(specifier); | ||
} | ||
hash.specifiers.addAll(specifiers.stream().collect(Collectors.toList())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually in a case like this, I think it's sufficient and more clear.
hash.specifiers.addAll(specifiers);
or more simply,
hash.specifiers = new ArrayList<>(specifiers);
Anyway, I think stream doesn't matter.
Because it is simple shallow copy, there are many ways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eminency Thanks for your comment. I agree with your opinion.
I'll rewrite it overall correlated with a simple shallow copy.
Time to merge. |
@eminency Thanks for your comment. Unfortunately, I face with some unsuspected error while travis test. I'm in investigation about it's cause. |
for (PartitionSpecifier specifier : specifiers) { | ||
hash.specifiers.add(specifier); | ||
} | ||
hash.specifiers = specifiers.stream().collect(Collectors.toList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is sufficient with:
hash.specifiers = new ArrayList<>(specifiers);
Even though they may not exact, I left some comments. |
@eminency Hi! Thanks for your comment. I apply your comment. |
I replace many foreach loop with stream api.