From f389d34fb86ab3c81217e22bf1e78849eaf76513 Mon Sep 17 00:00:00 2001 From: Ryan Moore Date: Wed, 27 Jul 2016 14:59:00 -0600 Subject: [PATCH] One final update to the way that filters are applied to the fluent iterable --- .../ds3client/helpers/Ds3ClientHelpers.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/ds3-sdk/src/main/java/com/spectralogic/ds3client/helpers/Ds3ClientHelpers.java b/ds3-sdk/src/main/java/com/spectralogic/ds3client/helpers/Ds3ClientHelpers.java index 8bcac3b84..1608ff39c 100644 --- a/ds3-sdk/src/main/java/com/spectralogic/ds3client/helpers/Ds3ClientHelpers.java +++ b/ds3-sdk/src/main/java/com/spectralogic/ds3client/helpers/Ds3ClientHelpers.java @@ -291,10 +291,6 @@ public abstract Iterable listObjects(final String bucket, final String */ public abstract Iterable removePrefixFromDs3ObjectsList(final Iterable objectsList, final String prefix); - public Iterable toDs3Iterable(final Iterable objects) { - return toDs3Iterable(objects, null); - } - @SafeVarargs public final Iterable toDs3Iterable(final Iterable objects, final Predicate... filters) { @@ -305,17 +301,19 @@ public boolean apply(@Nullable final Contents input) { } }); - for (final Predicate filter : filters) { - fluentIterable = fluentIterable.filter(new com.google.common.base.Predicate() { - @Override - public boolean apply(@Nullable final Contents input) { - if (filter != null) { - return filter.test(input); - } else { - return true; // do not filter anything if filter is null + if (filters != null) { + for (final Predicate filter : filters) { + fluentIterable = fluentIterable.filter(new com.google.common.base.Predicate() { + @Override + public boolean apply(@Nullable final Contents input) { + if (filter != null) { + return filter.test(input); + } else { + return true; // do not filter anything if filter is null + } } - } - }); + }); + } } return fluentIterable.transform(new Function() {