List of usage examples for com.google.common.collect FluentIterable contains
@CheckReturnValue public final boolean contains(@Nullable Object target)
From source file:com.spectralogic.ds3cli.command.GetBulk.java
private Iterable<Contents> getObjectsByPipe() throws CommandException { final ImmutableMap<String, String> pipedObjectMap = FileUtils.normalizedObjectNames(this.pipedFileNames); final FluentIterable<Contents> objectList = FluentIterable .from(new LazyIterable<>( new GetBucketLoaderFactory(getClient(), this.bucketName, null, null, 100, 5))) .filter(new Predicate<Contents>() { @Override//from w w w . j ava 2 s . co m public boolean apply(@Nullable final Contents bulkObject) { return pipedObjectMap.containsKey(bulkObject.getKey()); } }); // look for objects in the piped list not in bucket final FluentIterable<String> objectNameList = FluentIterable.from(objectList) .transform(new Function<Contents, String>() { @Override public String apply(@Nullable final Contents bulkObject) { return bulkObject.getKey(); } }); for (final String object : pipedObjectMap.keySet()) { if (objectNameList.contains(object)) { LOG.info("Restore: {}", object); } else { throw new CommandException("Object: " + object + " not found in bucket"); } } return objectList; }