Example usage for com.google.common.collect Iterables elementsEqual

List of usage examples for com.google.common.collect Iterables elementsEqual

Introduction

In this page you can find the example usage for com.google.common.collect Iterables elementsEqual.

Prototype

@CheckReturnValue
public static boolean elementsEqual(Iterable<?> iterable1, Iterable<?> iterable2) 

Source Link

Document

Determines whether two iterables contain equal elements in the same order.

Usage

From source file:com.google.gxp.compiler.parser.ParsedElement.java

/**
 * <p>This incomplete implementation checks to see if the chidren are the
 * same as this {@code ParsedElement}'s children, and if so returns this.
 * Otherwise it delegates to the {@code withChildrenImpl} method.
 *//*from  www  .  j av  a2s  .  co m*/
public final ParsedElement withChildren(List<ParsedElement> newChildren) {
    return ((children == newChildren) || Iterables.elementsEqual(children, newChildren)) ? this
            : withChildrenImpl(newChildren);
}

From source file:com.bah.culvert.transactions.Put.java

@Override
public boolean equals(Object obj) {
    if (obj instanceof Put) {
        return Iterables.elementsEqual(((Put) obj).keyValueList, this.keyValueList);
    }//from  w w  w  .ja  va 2  s.c o m
    return false;
}

From source file:org.jclouds.googlecomputeengine.compute.predicates.NetworkFirewallPredicates.java

public static Predicate<Firewall> equalsIpPermission(final IpPermission permission) {
    return new Predicate<Firewall>() {
        @Override//from   w  w  w .  j  av a2  s .com
        public boolean apply(Firewall input) {
            return Iterables.elementsEqual(permission.getGroupIds(), input.sourceTags())
                    && Iterables.elementsEqual(permission.getCidrBlocks(), input.sourceRanges())
                    && (input.allowed().size() == 1 && ruleEqualsIpPermission(permission)
                            .apply(Iterables.getOnlyElement(input.allowed())));
        }
    };
}

From source file:co.cask.cdap.data2.transaction.stream.StreamConsumerState.java

@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }/*from   w w  w . j  av a2s  . c o  m*/
    if (o == null || getClass() != o.getClass()) {
        return false;
    }

    StreamConsumerState other = (StreamConsumerState) o;

    return (groupId == other.groupId) && (instanceId == other.instanceId)
            && Iterables.elementsEqual(state, other.state);
}

From source file:com.google.gxp.compiler.alerts.AlertSet.java

public boolean equals(AlertSet that) {
    return Iterables.elementsEqual(this, that);
}

From source file:org.apache.beam.fn.harness.state.LazyCachingIteratorToIterable.java

@Override
public boolean equals(Object obj) {
    return obj instanceof Iterable && Iterables.elementsEqual(this, (Iterable) obj);
}

From source file:uk.ac.ebi.atlas.solr.admin.index.conditions.Condition.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }/*from w ww . j  a v  a2 s.co m*/
    if (obj == null || getClass() != obj.getClass()) {
        return false;
    }
    final Condition other = (Condition) obj;
    return Objects.equals(this.experimentAccession, other.experimentAccession)
            && Objects.equals(this.assayGroupId, other.assayGroupId)
            && Iterables.elementsEqual(this.values, other.values);
}

From source file:com.google.gxp.compiler.base.AbstractRoot.java

public T transformParameters(Function<Parameter, Parameter> parameterTransformer) {
    List<Parameter> newParameters = Util.map(getParameters(), parameterTransformer);

    return Iterables.elementsEqual(getParameters(), newParameters) ? self() : withParameters(newParameters);
}

From source file:org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.validator.InstanceRoleResizeValidator.java

/**
 * {@inheritDoc}/*from  ww  w.j av  a2  s.c om*/
 */
@Override
public boolean isValid(ChangeBoundsRequest request) {
    boolean valid = super.isValid(request);

    if (instanceRoles.size() != 0) {
        SequenceDiagram sequenceDiagram = instanceRoles.get(0).getDiagram();
        List<InstanceRole> preResizeOrder = sequenceDiagram.getSortedInstanceRole();

        RequestQuery query = new RequestQuery(request);
        Rectangle logicalDelta = query.getLogicalDelta();

        Point moveDelta = logicalDelta.getLocation();
        moveDelta.y = 0;
        Dimension sizeDelta = logicalDelta.getSize();

        for (InstanceRole instanceRole : instanceRoles) {
            moveDeltas.put(instanceRole, moveDelta.getCopy());
            sizeDeltas.put(instanceRole, sizeDelta.getCopy());

            Rectangle boundBeforeResizing = instanceRole.getBounds();
            Rectangle boundAfterResizing = boundBeforeResizing.getTranslated(moveDelta).resize(sizeDelta);

            if (boundAfterResizing.width <= 0) {
                valid = false;
            }
        }

        // Avoid all reorders
        List<InstanceRole> postResizeOrder = getPostResizeOrder(preResizeOrder);
        if (!Iterables.elementsEqual(preResizeOrder, postResizeOrder)) {
            valid = false;
        }
    }
    return valid;
}

From source file:com.google.gxp.compiler.base.Concatenation.java

public Expression withValues(List<Expression> newValues) {
    return Iterables.elementsEqual(newValues, values) ? this
            : create(getSourcePosition(), getSchema(), newValues);
}