Java Code Examples for java.util.Objects.equals()

The following are Jave code examples for showing how to use equals() of the java.util.Objects class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: uidcore-java   File: ProviderChannel.java   View Source Code Vote up 6 votes
@Override
public boolean equals(Object object) {

	if (!(object instanceof ProviderChannel))
		return false;
	
	if (this == object)
		return true;
	
	ProviderChannel providerChannel = (ProviderChannel) object;
	
	return Objects.equals(providerAddress, providerChannel.providerAddress) &&
			Objects.equals(userAddress, providerChannel.userAddress) &&
			Objects.equals(revokeAddress, providerChannel.revokeAddress) &&
			Objects.equals(bitmask, providerChannel.bitmask) &&
			Objects.equals(revokeTxId, providerChannel.revokeTxId) &&
			creationTime == providerChannel.creationTime;
}
 
Example 2
Project: db-queue   File: QueueRegistry.java   View Source Code Vote up 6 votes
/**
 * Зарегистрировать очередь.
 *
 * @param <T>           тип данных задачи
 * @param queueConsumer обработчик очереди
 * @param queueProducer постановщик задачи в очередь
 */
public synchronized <T> void registerQueue(@Nonnull QueueConsumer<T> queueConsumer,
                                           @Nonnull QueueProducer<T> queueProducer) {
    Objects.requireNonNull(queueConsumer);
    Objects.requireNonNull(queueProducer);
    ensureConstructionInProgress();
    QueueId queueId = queueConsumer.getQueueConfig().getLocation().getQueueId();

    if (!Objects.equals(queueConsumer.getQueueConfig(), queueProducer.getQueueConfig())) {
        errorMessages.add(String.format("queue config must be the same: queueId=%s, producer=%s, " +
                "consumer=%s", queueId, queueProducer.getQueueConfig(), queueConsumer.getQueueConfig()));
    }

    if (!Objects.equals(queueProducer.getPayloadTransformer(), queueConsumer.getPayloadTransformer())) {
        errorMessages.add(String.format("payload transformers must be the same: queueId=%s", queueId));
    }

    if (!Objects.equals(queueProducer.getShardRouter(), queueConsumer.getShardRouter())) {
        errorMessages.add(String.format("shard routers must be the same: queueId=%s", queueId));
    }

    if (consumers.putIfAbsent(queueId, queueConsumer) != null) {
        errorMessages.add("duplicate queue: queueId=" + queueId);
    }
}
 
Example 3
Project: sstable-adaptor   File: AbstractCell.java   View Source Code Vote up 6 votes
@Override
public boolean equals(Object other)
{
    if (this == other)
        return true;

    if(!(other instanceof Cell))
        return false;

    Cell that = (Cell)other;
    return this.column().equals(that.column())
        && this.isCounterCell() == that.isCounterCell()
        && this.timestamp() == that.timestamp()
        && this.ttl() == that.ttl()
        && this.localDeletionTime() == that.localDeletionTime()
        && Objects.equals(this.value(), that.value())
        && Objects.equals(this.path(), that.path());
}
 
Example 4
Project: datarouter   File: ManyFieldBean.java   View Source Code Vote up 5 votes
/***************************** static methods *****************************/

	public static List<ManyFieldBean> filterForStringValue(Collection<ManyFieldBean> ins, String value){
		List<ManyFieldBean> outs = new LinkedList<>();
		for(ManyFieldBean in : IterableTool.nullSafe(ins)){
			if(Objects.equals(in.getStringField(), value)){
				outs.add(in);
			}
		}
		return outs;
	}
 
Example 5
Project: agilion   File: Operation.java   View Source Code Vote up 5 votes
@Override
public boolean equals(java.lang.Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  Operation operation = (Operation) o;
  return Objects.equals(this.name, operation.name) &&
      Objects.equals(this.description, operation.description) &&
      Objects.equals(this.params, operation.params);
}
 
Example 6
Project: xm-ms-entity   File: XmEntityUtils.java   View Source Code Vote up 5 votes
public static Optional<XmEntity> getLinkedTarget(XmEntity xmEntity, String linkTypeKey, String linkTargetTypeKey) {
    Optional<Link> firstLink = findFirstLink(xmEntity, linkTypeKey);
    if (firstLink.isPresent()) {
        Link link = firstLink.get();
        XmEntity target = Objects.requireNonNull(link.getTarget(), "Link with type key '" + linkTypeKey + "' has null target");
        if (Objects.equals(target.getTypeKey(), linkTargetTypeKey)) {
            return Optional.of(target);
        }
    }

    return Optional.empty();
}
 
Example 7
Project: swaggy-jenkins   File: ResponseTimeMonitorData.java   View Source Code Vote up 5 votes
@Override
public boolean equals(java.lang.Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  ResponseTimeMonitorData responseTimeMonitorData = (ResponseTimeMonitorData) o;
  return Objects.equals(propertyClass, responseTimeMonitorData.propertyClass) &&
      Objects.equals(timestamp, responseTimeMonitorData.timestamp) &&
      Objects.equals(average, responseTimeMonitorData.average);
}
 
Example 8
Project: drift   File: ExceptionClassification.java   View Source Code Vote up 5 votes
@Override
public boolean equals(Object o)
{
    if (this == o) {
        return true;
    }
    if (o == null || getClass() != o.getClass()) {
        return false;
    }
    ExceptionClassification that = (ExceptionClassification) o;
    return Objects.equals(retry, that.retry) &&
            hostStatus == that.hostStatus;
}
 
Example 9
Project: smart-testing   File: ConfigurationAssert.java   View Source Code Vote up 5 votes
public ConfigurationAssert hasDebugLogEnabled(boolean debug) {
    isNotNull();

    if (!Objects.equals(actual.isDebug(), debug)) {
        failWithMessage("Expected debug to be <%s> but was <%s>", debug, actual.isDebug());
    }
    return this;
}
 
Example 10
Project: yum   File: Error.java   View Source Code Vote up 5 votes
@Override
public boolean equals(java.lang.Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  Error error = (Error) o;
  return Objects.equals(this.message, error.message) &&
      Objects.equals(this.error, error.error);
}
 
Example 11
Project: nifi-registry   File: VersionedFlowSnapshotMetadata.java   View Source Code Vote up 5 votes
@Override
public boolean equals(final Object obj) {
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }

    final VersionedFlowSnapshotMetadata other = (VersionedFlowSnapshotMetadata) obj;

    return Objects.equals(this.flowIdentifier, other.flowIdentifier)
            && Objects.equals(this.version, other.version);
}
 
Example 12
Project: ABC-List   File: ExerciseSqlService.java   View Source Code Vote up 5 votes
void create(Exercise exercise) {
    if (Objects.equals(exercise.getId(), DEFAULT_ID)) {
        exercise.setId(System.currentTimeMillis());
        DatabaseFacade.getDefault().getCrudService().create(exercise);
    }
    else {
        this.update(exercise);
    }
}
 
Example 13
Project: ArchUnit   File: PersistentObject.java   View Source Code Vote up 5 votes
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (obj == null || getClass() != obj.getClass()) {
        return false;
    }
    final PersistentObject other = (PersistentObject) obj;
    return Objects.equals(this.id, other.id);
}
 
Example 14
Project: yum   File: Login.java   View Source Code Vote up 5 votes
@Override
public boolean equals(java.lang.Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  Login login = (Login) o;
  return Objects.equals(this.email, login.email) &&
      Objects.equals(this.password, login.password) &&
      Objects.equals(this.username, login.username);

}
 
Example 15
Project: voicemenu   File: myVoice.java   View Source Code Vote up 5 votes
/**
 * stop speech
 */
public void stop() {

  if (Objects.equals(OS, "mac")) {
    Variables.macVoice.stop();
  } else if (Objects.equals(OS, "win")) {
    Variables.winVoice.stop();
  } else if (Objects.equals(OS, "unix")) {
    Variables.uniVoice.stop();
  } else {
    System.out.println("Voices are not supported");
  }
}
 
Example 16
Project: athena   File: ControlResourceRequest.java   View Source Code Vote up 5 votes
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (obj instanceof ControlResourceRequest) {
        final ControlResourceRequest other = (ControlResourceRequest) obj;
        return Objects.equals(this.type, other.type);
    }
    return false;
}
 
Example 17
Project: cereebro   File: SystemFragment.java   View Source Code Vote up 5 votes
@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    } else if (o == null || !getClass().equals(o.getClass())) {
        return false;
    }
    SystemFragment that = (SystemFragment) o;
    return Objects.equals(this.componentRelationships, that.componentRelationships);
}
 
Example 18
Project: pgcodekeeper   File: PgFunction.java   View Source Code Vote up 5 votes
/**
 * Compares two objects whether they are equal. If both objects are of the
 * same class but they equal just in whitespace in {@link #body}, they are
 * considered being equal.
 *
 * @param func                     object to be compared
 * @return true if {@code object} is PgFunction and the function code is
 *         the same when compared ignoring whitespace, otherwise returns
 *         false
 */
public boolean checkForChanges(PgFunction func) {
    boolean equals = false;

    if (this == func) {
        equals = true;
    } else {
        equals = Objects.equals(name, func.getBareName())
                && arguments.equals(func.arguments)
                && Objects.equals(body, func.getBody())
                && Objects.equals(returns, func.getReturns());
    }
    return equals;
}
 
Example 19
Project: elasticsearch_my   File: FiltersFunctionScoreQuery.java   View Source Code Vote up 5 votes
@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }
    if (sameClassAs(o) == false) {
        return false;
    }
    FiltersFunctionScoreQuery other = (FiltersFunctionScoreQuery) o;
    return Objects.equals(this.subQuery, other.subQuery) && this.maxBoost == other.maxBoost &&
        Objects.equals(this.combineFunction, other.combineFunction) && Objects.equals(this.minScore, other.minScore) &&
        Objects.equals(this.scoreMode, other.scoreMode) &&
        Arrays.equals(this.filterFunctions, other.filterFunctions);
}
 
Example 20
Project: AdvancedDataProfilingSeminar   File: Spider.java   View Source Code Vote up 4 votes
private boolean sameValue(final Attribute a1, final Attribute a2) {
  return Objects.equals(a1.getCurrentValue(), a2.getCurrentValue());
}