List of usage examples for com.google.common.collect Iterables elementsEqual
@CheckReturnValue public static boolean elementsEqual(Iterable<?> iterable1, Iterable<?> iterable2)
From source file:org.elasticsearch.search.suggest.context.ContextMapping.java
/** * Test equality of two mapping//www .j a va2 s . c om * * @param thisMappings first mapping * @param otherMappings second mapping * * @return true if both arguments are equal */ public static boolean mappingsAreEqual(SortedMap<String, ? extends ContextMapping> thisMappings, SortedMap<String, ? extends ContextMapping> otherMappings) { return Iterables.elementsEqual(thisMappings.entrySet(), otherMappings.entrySet()); }
From source file:com.google.gxp.compiler.base.Conditional.java
public Conditional withClauses(List<Clause> newClauses, Expression newElseExpression) { return (Iterables.elementsEqual(newClauses, clauses) && elseExpression.equals(newElseExpression)) ? this : new Conditional(this, getSchema(), newClauses, newElseExpression); }
From source file:org.eclipse.emf.compare.match.update.Updater.java
private void updateManyValuesAttribute(EAttribute attr) { Collection<Object> oldValues = getMany(element, attr); Collection<Object> newValues = getMany(reference, attr); if (!Iterables.elementsEqual(oldValues, newValues)) { oldValues.clear();/*from w w w .j av a 2 s .c o m*/ oldValues.addAll(newValues); } }
From source file:nextmethod.web.razor.parser.syntaxtree.Block.java
private static boolean childrenEqual(final Iterable<SyntaxTreeNode> left, final Iterable<SyntaxTreeNode> right) { return Iterables.elementsEqual(left, right); }
From source file:nextmethod.web.razor.parser.syntaxtree.Span.java
@Override public boolean equals(@Nullable Object o) { if (o == null || !(o instanceof Span)) return false; final Span other = typeAs(o, Span.class); return kind.equals(other.kind) && editHandler.equals(other.editHandler) && codeGenerator.equals(other.codeGenerator) && Iterables.elementsEqual(symbols, other.symbols); }
From source file:org.eclipse.sirius.diagram.sequence.business.internal.operation.SynchronizeInstanceRoleSemanticOrderingOperation.java
private void updateSemanticPosition(InstanceRole instanceRoleToUpdate) { DDiagramElement dde = resolveDiagramElement(instanceRoleToUpdate); if (dde == null || reordered.contains(instanceRoleToUpdate)) { return;//w ww.j ava 2 s . c o m } InstanceRoleReorderTool reorderTool = findReorderTool(dde); if (reorderTool == null) { return; } EObject semanticElement = dde.getTarget(); List<EObject> rolesBySemanticOrder = sequenceDiagram.getInstanceRoleSemanticOrdering() .getSemanticInstanceRoles(); List<EObject> rolesByGraphicalOrder = getSemanticInstanceRolesByGraphicalOrder(); // The semantic ordering contains the state before the move EObject predecessorBefore = findEndPredecessor(semanticElement, rolesBySemanticOrder); // The graphical ordering contains the state after EObject predecessorAfter = findEndPredecessor(semanticElement, rolesByGraphicalOrder); if (!rolesBySemanticOrder.isEmpty() && !Objects.equal(predecessorBefore, predecessorAfter) || !Iterables.elementsEqual(rolesBySemanticOrder, rolesByGraphicalOrder)) { applySemanticReordering(semanticElement, predecessorBefore, predecessorAfter, reorderTool); reordered.add(instanceRoleToUpdate); new RefreshSemanticOrderingsOperation(sequenceDiagram).execute(); } }
From source file:com.google.gxp.compiler.base.OutputElement.java
public boolean equals(OutputElement that) { return equalsExpression(that) && Objects.equal(innerSchema, that.innerSchema) && localName.equals(that.localName) && validator.equals(that.validator) && Objects.equal(docType, that.docType) && Iterables.elementsEqual(attributes, that.attributes) && Iterables.elementsEqual(attrBundles, that.attrBundles) && Objects.equal(phName, that.phName) && content.equals(that.content); }
From source file:org.opendaylight.yangtools.yang.binding.InstanceIdentifier.java
@Override public final boolean equals(final Object obj) { if (this == obj) { return true; }/* w w w. jav a 2 s.c o m*/ if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final InstanceIdentifier<?> other = (InstanceIdentifier<?>) obj; if (pathArguments == other.pathArguments) { return true; } /* * We could now just go and compare the pathArguments, but that * can be potentially expensive. Let's try to avoid that by * checking various things that we have cached from pathArguments * and trying to prove the identifiers are *not* equal. */ if (hash != other.hash) { return false; } if (wildcarded != other.wildcarded) { return false; } if (targetType != other.targetType) { return false; } if (fastNonEqual(other)) { return false; } // Everything checks out so far, so we have to do a full equals return Iterables.elementsEqual(pathArguments, other.pathArguments); }
From source file:com.jeffplaisance.util.fingertree.list.IndexedList.java
@Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof IndexedList)) { return false; }//from w w w . j a v a2 s . co m final IndexedList other = (IndexedList) obj; return size() == other.size() && Iterables.elementsEqual(this, other); }
From source file:org.apache.cassandra.db.rows.AbstractRow.java
@Override public boolean equals(Object other) { if (!(other instanceof Row)) return false; Row that = (Row) other;/* www .j av a2 s . c o m*/ if (!this.clustering().equals(that.clustering()) || !this.primaryKeyLivenessInfo().equals(that.primaryKeyLivenessInfo()) || !this.deletion().equals(that.deletion())) return false; return Iterables.elementsEqual(this, that); }