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.killbill.billing.util.tag.dao.SystemTags.java
public static boolean isSystemTag(final UUID tagDefinitionId) { return Iterables.any(SYSTEM_DEFINED_TAG_DEFINITIONS, new Predicate<TagDefinitionModelDao>() { @Override/*from ww w . j a va 2 s. c o m*/ public boolean apply(final TagDefinitionModelDao input) { return input.getId().equals(tagDefinitionId); } }); }
From source file:org.yakindu.base.types.annotations.TypeAnnotations.java
public boolean hasAnnotation(final AnnotatableElement element, final String name) { return Iterables.any(element.getAnnotations(), new Predicate<Annotation>() { @Override/* w ww. j a v a 2 s. co m*/ public boolean apply(Annotation input) { return input.getName().equals(name); } }); }
From source file:org.eclipse.che.ide.actions.FoldersAlwaysOnTopAction.java
@Override public boolean isSelected(ActionEvent e) { return Iterables.any(view.getSortInfo(), matching()); }
From source file:com.facebook.buck.android.ProguardTranslatorFactory.java
private static Optional<Map<String, String>> loadOptionalRawMap(ExecutionContext context, Optional<Path> proguardFullConfigFile, Optional<Path> proguardMappingFile) throws IOException { if (!proguardFullConfigFile.isPresent()) { return Optional.absent(); }// w ww . j a v a 2s .co m ProjectFilesystem projectFilesystem = context.getProjectFilesystem(); Path pathToProguardConfig = proguardFullConfigFile.get(); // Proguard doesn't print a mapping when obfuscation is disabled. boolean obfuscationSkipped = Iterables.any(projectFilesystem.readLines(pathToProguardConfig), Predicates.equalTo("-dontobfuscate")); if (obfuscationSkipped) { return Optional.absent(); } List<String> lines = projectFilesystem.readLines(proguardMappingFile.get()); return Optional.of(ProguardMapping.readClassMapping(lines)); }
From source file:brooklyn.location.affinity.EntityTypeAffinityRule.java
@Override public boolean apply(@Nullable Location input) { Collection<Entity> all = getManagementContext().getEntityManager().getEntities(); return Iterables.any(Iterables.filter(all, entityType), EntityPredicates.withLocation(input)); }
From source file:org.eclipse.sirius.common.tools.internal.interpreter.PolymorphicService.java
public boolean appliesTo(Object[] target) { return Iterables.any(implementers, getCompatibilityChecker(target)); }
From source file:org.eclipse.xtext.graphview.behavior.visibility.RevealButton.java
protected boolean hasHiddenEdge() { AbstractInstance model = getHost().getModel(); if (model instanceof NodeInstance) { NodeInstance node = (NodeInstance) model; return Iterables.any(Iterables.concat(node.getOutgoingEdges(), node.getIncomingEdges()), new Predicate<EdgeInstance>() { public boolean apply(EdgeInstance input) { return input.getVisibility() == Visibility.HIDDEN; }//from w w w. ja v a2 s . co m }); } else { return false; } }
From source file:org.scassandra.cql.SetType.java
@Override public boolean equals(Object expected, Object actual) { if (expected == null) return actual == null; if (actual == null) return false; if (expected instanceof Set) { final Set<?> typedExpected = (Set<?>) expected; final List<?> actualList = (List<?>) actual; return typedExpected.size() == actualList.size() && Iterables.all(typedExpected, new Predicate<Object>() { @Override/*from www. jav a 2 s . com*/ public boolean apply(final Object eachExpected) { return Iterables.any(actualList, new Predicate<Object>() { @Override public boolean apply(Object eachActual) { return type.equals(eachExpected, eachActual); } }); } }); } else { throw throwInvalidType(expected, actual, this); } }
From source file:org.obeonetwork.dsl.uml2.design.internal.listeners.UmlDesignerSessionListener.java
public void notify(int changeKind) { if (changeKind == SessionListener.OPENED || changeKind == SessionListener.SELECTED_VIEWS_CHANGE_KIND) { // The Reused viewpoint must not be disabled by the user as other viewpoints depend on it, so it // is re-enabled automatically at the session opening or when the user change the viewpoint // selection if (Iterables.any(session.getSelectedViewpoints(false), new Predicate<Viewpoint>() { public boolean apply(Viewpoint selectedViewpoint) { return UmlViewpoints.isUmlViewpoint(selectedViewpoint); }/*from ww w. ja v a2 s .c o m*/ })) { final Viewpoint reused = UmlViewpoints.fromViewpointRegistry().reused(); if (Iterables.indexOf(session.getSelectedViewpoints(false), new Predicate<Viewpoint>() { public boolean apply(Viewpoint selectedViewpoint) { return selectedViewpoint.getName().equals(reused.getName()); } }) == -1) { UmlViewpoints.enableReused(session); } } } }
From source file:org.eclipse.rcptt.internal.launching.ext.UpdateVMArgs.java
public static void addIfAbsent(List<String> target, String prefix, String value) { if (!Iterables.any(target, new StartsWith(prefix))) { target.add(prefix + value);/*from w w w.ja v a2 s . co m*/ } }