Example usage for com.google.common.collect Iterators any

List of usage examples for com.google.common.collect Iterators any

Introduction

In this page you can find the example usage for com.google.common.collect Iterators any.

Prototype

public static <T> boolean any(Iterator<T> iterator, Predicate<? super T> predicate) 

Source Link

Document

Returns true if one or more elements returned by iterator satisfy the given predicate.

Usage

From source file:org.eclipse.sirius.common.tools.api.resource.ResourceMigrationMarker.java

/**
 * Return true if the {@link Resource} has a migration marker.
 * //from   w  w  w  .j  a  v a 2  s  .c  o m
 * @param res
 *            resource to test.
 * @return true if the {@link Resource} has a migration marker.
 */
public static boolean hasMigrationMarker(Resource res) {
    return Iterators.any(res.eAdapters().iterator(), Predicates.instanceOf(ResourceMigrationMarker.class));
}

From source file:com.webbfontaine.valuewebb.irms.impl.bean.Calculator.java

private static boolean anyNull(BigDecimal... values) {
    return Iterators.any(Iterators.forArray(values), new EqualsNullPredicate());
}

From source file:org.fcrepo.http.commons.domain.Prefer.java

/**
 * Does the Prefer: header have a return tag
 * @return//from w w w .  j  a va  2s .  c o m
 */
public Boolean hasReturn() {
    return Iterators.any(preferTags.iterator(), getPreferTag("return"));
}

From source file:com.webbfontaine.valuewebb.irms.impl.bean.Calculator.java

private static boolean anyZero(BigDecimal... values) {
    return Iterators.any(Iterators.forArray(values), new EqualsZeroPredicate());
}

From source file:io.pcp.parfait.CompositeMonitoringView.java

@Override
/**// w  w  w .  ja  v a 2 s  . c  o m
 * For a Composite view, isRunning() is true if any of the underlying views are still running
 */
public boolean isRunning() {
    return Iterators.any(monitoringViews.iterator(), new Predicate<MonitoringView>() {
        @Override
        public boolean apply(MonitoringView mv) {
            return mv.isRunning();
        }
    });
}

From source file:com.webbfontaine.valuewebb.irms.impl.bean.Calculator.java

private static boolean anyNullOrZero(BigDecimal... values) {
    Predicate<BigDecimal> composite = Predicates.or(new EqualsNullPredicate(), new EqualsZeroPredicate());
    return Iterators.any(Iterators.forArray(values), composite);
}

From source file:org.openengsb.core.services.internal.security.AdminAccessConnector.java

@Override
public Access checkAccess(String username, Object action) {
    try {/*from  w  w w  . j  a  v  a 2  s .  c  om*/
        Collection<Permission> userPermissions = userManager.getAllPermissionsForUser(username);
        boolean allowed = Iterators.any(userPermissions.iterator(), new Predicate<Permission>() {
            @Override
            public boolean apply(Permission input) {
                return input.getClass().equals(RootPermission.class);
            }
        });
        if (allowed) {
            return Access.GRANTED;
        }
    } catch (UserNotFoundException e) {
        LOGGER.warn("user for access control decision was not found", e);
        // just let it abstain
    }
    return Access.ABSTAINED;
}

From source file:zotmc.collect.delegate.IterativeMap.java

@SuppressWarnings("unchecked")
@Override//from  w  w w . j  a  v a 2 s. c  om
public boolean containsValue(Object value) {
    return Iterators.any(entrySet().iterator(), valueEqualTo((V) value));
}

From source file:org.eclipse.sirius.common.xtext.internal.XtextSessionManagerListener.java

protected boolean containsXtextResources(TransactionalEditingDomain ted) {
    return ted.getResourceSet() != null && Iterators.any(ted.getResourceSet().getResources().iterator(),
            Predicates.instanceOf(XtextResource.class));
}

From source file:com.demigodsrpg.norsedemigods.util.WorldGuardUtil.java

/**
 * Check that a ProtectedRegion exists at a Location.
 *
 * @param name     The name of the region.
 * @param location The location being checked.
 * @return The region does exist at the provided location.
 *///from   ww w.  ja va  2 s .c  om
public static boolean checkForRegion(final String name, Location location) {
    return Iterators.any(WorldGuardPlugin.inst().getRegionManager(location.getWorld())
            .getApplicableRegions(location).iterator(), region -> region.getId().toLowerCase().contains(name));
}