vdiravka commented on a change in pull request #1397: DRILL-6633: Replace usage
of Guava classes by JDK ones
URL: https://github.com/apache/drill/pull/1397#discussion_r210777693
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/schema/ObjectSchema.java
##########
@@ -71,19 +70,16 @@ public void resetMarkedFields() {
@Override
public Iterable<? extends Field> removeUnreadFields() {
- final List<Field> removedFields = Lists.newArrayList();
- Iterables.removeIf(fields.values(), new Predicate<Field>() {
- @Override
- public boolean apply(Field field) {
- if (!field.isRead()) {
- removedFields.add(field);
- return true;
- } else if (field.hasSchema()) {
- Iterables.addAll(removedFields,
field.getAssignedSchema().removeUnreadFields());
- }
-
- return false;
+ List<Field> removedFields = new ArrayList<>();
+ fields.values().removeIf(field -> {
+ if (!field.isRead()) {
+ removedFields.add(field);
+ return true;
+ } else if (field.hasSchema()) {
+ Iterables.addAll(removedFields,
field.getAssignedSchema().removeUnreadFields());
Review comment:
What about Iterables replace?
`Field[] removedFields = `
`
StreamSupport.stream(field.getAssignedSchema().removeUnreadFields().spliterator(),
false)`
` .toArray(Field[]::new);`
` Collections.addAll(allRemovedFields, removedFields);`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services