org.apache.commons.lang3.builder.HashCodeBuilder Java Examples

The following examples show how to use org.apache.commons.lang3.builder.HashCodeBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SymmetricImmutablePair.java    From liblevenshtein-java with MIT License 6 votes vote down vote up
/**
 * Constructs a new symmetric, immutable pair on the given parameters.  The
 * hashCode is determined upon construction, so the assumption is made that
 * first and second are immutable or will not be mutated. If they or any of
 * their hashable components are mutated post-construction, the hashCode will
 * be incorrect and the behavior of instances of this pair in such structures
 * as hash maps will be undefined (e.g. this pair may seem to "disappear" from
 * the hash map, even though it's still there).
 * @param first First element of this pair
 * @param second Second element of this pair
 */
public SymmetricImmutablePair(
    @NonNull final Type first,
    @NonNull final Type second) {

  if (first.compareTo(second) < 0) {
    this.first = first;
    this.second = second;
  }
  else {
    this.first = second;
    this.second = first;
  }

  this.hashCode = new HashCodeBuilder(541, 7873)
    .append(this.first)
    .append(this.second)
    .toHashCode();
}
 
Example #2
Source File: FileToolTestBean.java    From VocabHunter with Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
    return new HashCodeBuilder()
        .append(left)
        .append(right)
        .toHashCode();
}
 
Example #3
Source File: Or.java    From angelix with MIT License 5 votes vote down vote up
@Override
public int hashCode() {
    return new HashCodeBuilder(17, 31).
            append(left).
            append(right).
            toHashCode();
}
 
Example #4
Source File: GCounter.java    From wurmloch-crdt with Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
    return new HashCodeBuilder(17, 37)
            .appendSuper(super.hashCode())
            .append(entries)
            .toHashCode();
}
 
Example #5
Source File: AbstractPatchItem.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
    return new HashCodeBuilder().
            appendSuper(super.hashCode()).
            append(value).
            build();
}
 
Example #6
Source File: ServerGroupStateRevision.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int hashCode() {
    return new HashCodeBuilder()
            .appendSuper(super.hashCode())
            .append(getGroup())
            .toHashCode();
}
 
Example #7
Source File: AccessToken.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int hashCode() {
    return new HashCodeBuilder()
            .append(getToken())
            .append(getExpiration())
            .append(getChannels())
            .append(getMinion())
            .toHashCode();
}
 
Example #8
Source File: BugDescription.java    From sailfish-core with Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();

    builder.append(categories);

    return builder.toHashCode();
}
 
Example #9
Source File: ContainerState.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
  return new HashCodeBuilder(137, 757)
      .append(owner)
      .append(pipelineID)
      .toHashCode();
}
 
Example #10
Source File: GoogleMfaAuthAccount.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
    return new HashCodeBuilder()
        .appendSuper(super.hashCode())
        .append(key)
        .append(secretKey)
        .append(owner)
        .append(scratchCodes)
        .append(validationCode)
        .append(registrationDate)
        .toHashCode();
}
 
Example #11
Source File: WikiDeletedActivity.java    From backlog4j with MIT License 5 votes vote down vote up
@Override
public int hashCode() {
    return new HashCodeBuilder()
            .append(type)
            .append(content)
            .toHashCode();
}
 
Example #12
Source File: CountResultItem.java    From java-pilosa with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public int hashCode() {
    return new HashCodeBuilder(31, 47)
            .append(this.id)
            .append(key)
            .append(this.count)
            .toHashCode();
}
 
Example #13
Source File: FlutterOutlineAttribute.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public int hashCode() {
  HashCodeBuilder builder = new HashCodeBuilder();
  builder.append(name);
  builder.append(label);
  builder.append(literalValueBoolean);
  builder.append(literalValueInteger);
  builder.append(literalValueString);
  builder.append(nameLocation);
  builder.append(valueLocation);
  return builder.toHashCode();
}
 
Example #14
Source File: NettySession.java    From jstarcraft-core with Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
    HashCodeBuilder hash = new HashCodeBuilder();
    hash.append(key);
    hash.append(context);
    return hash.toHashCode();
}
 
Example #15
Source File: ServerSnapshot.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 * {@inheritDoc}
 */
@Override
public int hashCode() {
    return new HashCodeBuilder().append(reason.hashCode())
                                .append(channels.hashCode())
                                .append(configChannels.hashCode())
                                .append(configRevisions.hashCode())
                                .append(server.hashCode())
                                .append(groups.hashCode())
                                .toHashCode();
}
 
Example #16
Source File: NesterovLearner.java    From jstarcraft-ai with Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
    HashCodeBuilder hash = new HashCodeBuilder();
    hash.append(learnSchedule);
    hash.append(momentumSchedule);
    return hash.toHashCode();
}
 
Example #17
Source File: SpiderInfo.java    From spider with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int hashCode() {
    return new HashCodeBuilder(17, 37)
            .append(getThread())
            .append(getRetry())
            .append(getSleep())
            .append(getMaxPageGather())
            .append(getTimeout())
            .append(getPriority())
            .append(isGatherFirstPage())
            .append(getSiteName())
            .append(getDomain())
            .append(getStartURL())
            .append(getContentReg())
            .append(getContentXPath())
            .append(getTitleReg())
            .append(getTitleXPath())
            .append(getCategoryReg())
            .append(getCategoryXPath())
            .append(getDefaultCategory())
            .append(getUrlReg())
            .append(getCharset())
            .append(getPublishTimeXPath())
            .append(getPublishTimeReg())
            .append(getPublishTimeFormat())
            .append(isDoNLP())
            .append(isNeedTitle())
            .append(isNeedContent())
            .append(isNeedPublishTime())
            .append(getLang())
            .append(getCountry())
            .append(getUserAgent())
            .append(getDynamicFields())
            .append(getStaticFields())
            .append(isSaveCapture())
            .append(isAutoDetectPublishDate())
            .toHashCode();
}
 
Example #18
Source File: ApacheCloudStackApiCommandParameter.java    From apache-cloudstack-java-client with Apache License 2.0 5 votes vote down vote up
/**
 * The hashcode is following the same idea as the {@link #compareTo(ApacheCloudStackApiCommandParameter)} method.
 */
@Override
public int hashCode() {
    HashCodeBuilder hashCodeBuilder = new HashCodeBuilder();
    hashCodeBuilder.append(this.name);
    return hashCodeBuilder.toHashCode();
}
 
Example #19
Source File: Comment.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public int hashCode() {
       return new HashCodeBuilder().
         append(gradableObject).
         append(id).
         append(commentText).
         toHashCode();
}
 
Example #20
Source File: InvalidRequestException.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
  HashCodeBuilder builder = new HashCodeBuilder();

  boolean present_why = true && (isSetWhy());
  builder.append(present_why);
  if (present_why)
    builder.append(why);

  return builder.toHashCode();
}
 
Example #21
Source File: Maintainer.java    From jkube with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
  return new HashCodeBuilder(17, 37)
      .append(name)
      .append(email)
      .toHashCode();
}
 
Example #22
Source File: ContentFilter.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int hashCode() {
    return new HashCodeBuilder(17, 37)
            .append(org)
            .append(name)
            .toHashCode();
}
 
Example #23
Source File: NotEqual.java    From angelix with MIT License 5 votes vote down vote up
@Override
public int hashCode() {
    return new HashCodeBuilder(17, 31).
            append(left).
            append(right).
            toHashCode();
}
 
Example #24
Source File: HttpConcatParam.java    From feilong-taglib with Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode(){
    //返回该对象的哈希码值  支持此方法是为了提高哈希表(例如 java.util.Hashtable 提供的哈希表)的性能. 

    //当我们向一个集合中添加某个元素,集合会首先调用hashCode方法,这样就可以直接定位它所存储的位置,
    //若该处没有其他元素,则直接保存.

    //若该处已经有元素存在,
    //就调用equals方法来匹配这两个元素是否相同,相同则不存,
    //不同则散列到其他位置(具体情况请参考(Java提高篇()-----HashMap)).

    //这样处理,当我们存入大量元素时就可以大大减少调用equals()方法的次数,极大地提高了效率.

    //hashCode在上面扮演的角色为寻域(寻找某个对象在集合中区域位置)

    //---------------------------------------------------------------
    //可替代地,存在使用反射来确定测试中的字段的方法.
    //因为这些字段通常是私有的,该方法中,reflectionHashCode,使用AccessibleObject.setAccessible改变字段的可见性.
    //这点会在一个安全管理器失败,除非相应的权限设置是否正确.
    //它也比明确地测试速度较慢. 
    //HashCodeBuilder.reflectionHashCode(this)
    //---------------------------------------------------------------
    //你选择一个硬编码,随机选择,不为零,奇数 
    //理想情况下,每个类不同

    HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(3, 5);
    return hashCodeBuilder//
                    .append(this.domain)//
                    .append(this.httpConcatSupport)//
                    .append(this.root)//
                    .append(this.type)//
                    .append(this.version)//
                    .append(this.domain)//
                    .append(this.content)//
                    .toHashCode();
}
 
Example #25
Source File: SessionWord.java    From VocabHunter with Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
    return new HashCodeBuilder()
        .append(wordIdentifier)
        .append(uses)
        .append(lineNos)
        .append(useCount)
        .append(state)
        .append(note)
        .toHashCode();
}
 
Example #26
Source File: ReturnMappedAttributeReleasePolicy.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
@Override
public int hashCode() {
    return new HashCodeBuilder()
            .appendSuper(super.hashCode())
            .append(allowedAttributes)
            .toHashCode();
}
 
Example #27
Source File: SslContentSource.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public int hashCode() {
    return new HashCodeBuilder().append(getCaCert())
            .append(getClientCert())
            .append(getClientKey())
            .toHashCode();
}
 
Example #28
Source File: ConfigProperty.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
    return new HashCodeBuilder(17, 37)
            .append(name)
            .append(prefix)
            .append(directory)
            .toHashCode();
}
 
Example #29
Source File: Widget.java    From bonita-ui-designer with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int hashCode() {
    return new HashCodeBuilder(17, 37)
            .append(id)
            .append(name)
            .append(template)
            .append(controller)
            .append(custom)
            .append(properties)
            .append(hasHelp)
            .toHashCode();
}
 
Example #30
Source File: AverageClusteringCoefficient.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
	return new HashCodeBuilder()
		.append(vertexCount)
		.append(averageLocalClusteringCoefficient)
		.hashCode();
}