List of usage examples for com.google.common.collect Iterables any
public static <T> boolean any(Iterable<T> iterable, Predicate<? super T> predicate)
From source file:org.apache.cassandra.db.view.TableViews.java
public boolean contains(String viewName) { return Iterables.any(views, view -> view.name.equals(viewName)); }
From source file:com.cognifide.cq.cqsm.core.progress.ProgressImpl.java
private void calculateSuccess() { success = !Iterables.any(entries, new IsErrorPredicate()); }
From source file:com.google.devtools.build.lib.skyframe.RecursivePkgValueRootPackageExtractor.java
public Iterable<PathFragment> getPackagesFromRoots(WalkableGraph graph, List<Root> roots, ExtendedEventHandler eventHandler, RepositoryName repository, PathFragment directory, ImmutableSet<PathFragment> blacklistedSubdirectories, ImmutableSet<PathFragment> excludedSubdirectories) throws InterruptedException { LinkedHashSet<PathFragment> packageNames = new LinkedHashSet<>(); for (Root root : roots) { // Note: no need to check if lookup == null because it will never be null. // {@link RecursivePkgFunction} handles all errors in a keep_going build. // In a nokeep_going build, we would never reach this part of the code. RecursivePkgValue lookup = (RecursivePkgValue) graph.getValue(RecursivePkgValue.key(repository, RootedPath.toRootedPath(root, directory), blacklistedSubdirectories)); Preconditions.checkState(lookup != null, "Root %s in repository %s could not be found in the graph.", root.asPath(), repository.getName()); for (String packageName : lookup.getPackages()) { // TODO(bazel-team): Make RecursivePkgValue return NestedSet<PathFragment> so this transform // is unnecessary. PathFragment packageNamePathFragment = PathFragment.create(packageName); if (!Iterables.any(excludedSubdirectories, excludedSubdirectory -> packageNamePathFragment.startsWith(excludedSubdirectory))) { packageNames.add(packageNamePathFragment); }//from w ww . j a va 2 s .c o m } } return packageNames; }
From source file:org.eclipse.sirius.tests.support.internal.helper.CrossReferenceAdapterDetector.java
/** * Check that the given Notifier does not have a CrossReferencerAdatper * CrossReferencerAdatper./*from w w w .j av a 2 s . c o m*/ * * @param notifier * the notifier to check. * @return true if a CrossReferencerAdapter has been found. */ public static boolean hasCrossReferenceAdapter(Notifier notifier) { return Iterables.any(notifier.eAdapters(), Predicates.instanceOf(org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter.class)); }
From source file:com.eucalyptus.simpleworkflow.ws.SimpleWorkflowPipeline.java
@Override public boolean checkAccepts(final HttpRequest message) { if (message instanceof MappingHttpRequest) { final boolean targetHeaderIsSwf = Strings.startsWith("SimpleWorkflowService.") .apply(message.getHeader("X-Amz-Target")); final boolean usesServicePath = Iterables.any(servicePathPrefixes, Strings.isPrefixOf(message.getUri())); final boolean noPath = message.getUri().isEmpty() || message.getUri().equals("/") || message.getUri().startsWith("/?"); return targetHeaderIsSwf && (usesServicePath || (noPath && resolvesByHost(message.getHeader(HttpHeaders.Names.HOST)))); }/*from w ww . j a va2s .c o m*/ return false; }
From source file:org.eclipse.sirius.diagram.business.api.query.CompositeFilterDescriptionQuery.java
private boolean hasFilter(FilterKind filterKind) { return Iterables.any(composite.getFilters(), new FilterKindPredicate(filterKind)); }
From source file:com.atlassian.jira.web.action.admin.ViewLicense.java
public boolean isLicenseSet() { Iterable<LicenseDetails> allLicenseDetails = allLicenseDetails(); return Iterables.any(allLicenseDetails, new Predicate<LicenseDetails>() { public boolean apply(@Nullable final LicenseDetails licenseDetails) { return licenseDetails != null && licenseDetails.isLicenseSet(); }/*from w w w.j a v a 2s .c o m*/ }); }
From source file:org.cicomponents.github.impl.PullRequestMonitor.java
@SneakyThrows private void ensureHookIsPresent() { GitHub gitHub = GitHub.connectUsingOAuth(tokenProvider.getAccessToken()); GHRepository repository = gitHub.getRepository(this.repository); boolean hookPresent = Iterables.any(repository.getHooks(), hook -> hook.getConfig().getOrDefault(CI_COMPONENTS_TYPE, "").contentEquals(TYPE)); if (!hookPresent) { log.info("No pull request hook present for {}, creating one", this.repository); Map<String, String> props = new HashMap<>(); props.put(CI_COMPONENTS_TYPE, TYPE); props.put("url", environment.getConfiguration().getUrl() + GithubPRWebhookServlet.PATH); props.put("content_type", "json"); repository.createHook(HOOK_NAME, props, Arrays.asList(GHEvent.PULL_REQUEST), true); }//from w w w. j a va 2 s. c om }
From source file:de.flapdoodle.guava.Expectations.java
/** * @see Iterables#any(Iterable, Predicate) *///from ww w .j a va2 s. co m @Deprecated public static <T> boolean any(Collection<T> candidates, Predicate<T> condition) { return Iterables.any(candidates, condition); }
From source file:com.atlassian.jira.license.DefaultLicenseRoleManager.java
@Override public boolean isLicenseRoleDefined(@Nonnull final LicenseRoleId licenseRoleId) { Assertions.notNull("licenseRoleId", licenseRoleId); return Iterables.any(getUniqueLicenseRoleDefinitions(), findId(licenseRoleId)); }