Remove use of com.google.common.collect.Iterables

This commit removes all uses of com.google.common.collect.Iterables
across the codebase.

Relates elastic/elasticsearchelastic/elasticsearch#13224

Original commit: elastic/x-pack-elasticsearch@ca517de412
This commit is contained in:
Jason Tedor 2015-09-14 13:26:04 -04:00
parent 3676d6e370
commit 08de4a4ab1
4 changed files with 9 additions and 8 deletions

View File

@ -19,7 +19,6 @@ import org.elasticsearch.shield.authc.support.SecuredString;
import java.util.regex.Pattern;
import static com.google.common.collect.Iterables.all;
import static java.util.Arrays.asList;
/**
@ -147,8 +146,8 @@ public abstract class SessionFactory {
return true;
}
boolean allSecure = all(asList(ldapUrls), s -> STARTS_WITH_LDAPS.matcher(s).find());
boolean allClear = all(asList(ldapUrls), s -> STARTS_WITH_LDAP.matcher(s).find());
boolean allSecure = asList(ldapUrls).stream().allMatch(s -> STARTS_WITH_LDAPS.matcher(s).find());
boolean allClear = asList(ldapUrls).stream().allMatch(s -> STARTS_WITH_LDAP.matcher(s).find());
if (!allSecure && !allClear) {
//No mixing is allowed because we use the same socketfactory

View File

@ -5,7 +5,6 @@
*/
package org.elasticsearch.watcher.execution;
import com.google.common.collect.Iterables;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
@ -14,6 +13,8 @@ import org.elasticsearch.watcher.trigger.TriggerEngine;
import org.elasticsearch.watcher.trigger.TriggerEvent;
import org.elasticsearch.watcher.trigger.TriggerService;
import java.util.stream.StreamSupport;
/**
*/
public class AsyncTriggerListener implements TriggerEngine.Listener {
@ -33,7 +34,7 @@ public class AsyncTriggerListener implements TriggerEngine.Listener {
try {
executionService.processEventsAsync(events);
} catch (Exception e) {
logger.error("failed to process triggered events [{}]", e, (Object)Iterables.toArray(events, TriggerEvent.class));
logger.error("failed to process triggered events [{}]", e, (Object) StreamSupport.stream(events.spliterator(), false).toArray(size -> new TriggerEvent[size]));
}
}

View File

@ -5,7 +5,6 @@
*/
package org.elasticsearch.watcher.execution;
import com.google.common.collect.Iterables;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
@ -14,6 +13,8 @@ import org.elasticsearch.watcher.trigger.TriggerEngine;
import org.elasticsearch.watcher.trigger.TriggerEvent;
import org.elasticsearch.watcher.trigger.TriggerService;
import java.util.stream.StreamSupport;
/**
*/
public class SyncTriggerListener implements TriggerEngine.Listener {
@ -33,7 +34,7 @@ public class SyncTriggerListener implements TriggerEngine.Listener {
try {
executionService.processEventsSync(events);
} catch (Exception e) {
logger.error("failed to process triggered events [{}]", e, (Object)Iterables.toArray(events, TriggerEvent.class));
logger.error("failed to process triggered events [{}]", e, (Object) StreamSupport.stream(events.spliterator(), false).toArray(size -> new TriggerEvent[size]));
}
}

View File

@ -9,7 +9,7 @@ import com.fasterxml.jackson.core.io.JsonStringEncoder;
import com.github.mustachejava.DefaultMustacheFactory;
import com.github.mustachejava.MustacheException;
import com.github.mustachejava.reflect.ReflectionObjectHandler;
import com.google.common.collect.Iterables;
import org.elasticsearch.common.util.iterable.Iterables;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.watcher.support.ArrayObjectIterator;