当前位置: 首页>>代码示例>>Java>>正文


Java Collection.hashCode方法代码示例

本文整理汇总了Java中java.util.Collection.hashCode方法的典型用法代码示例。如果您正苦于以下问题:Java Collection.hashCode方法的具体用法?Java Collection.hashCode怎么用?Java Collection.hashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Collection的用法示例。


在下文中一共展示了Collection.hashCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doPortfolio

import java.util.Collection; //导入方法依赖的package包/类
private int doPortfolio(String uid) {
  int rtn = 0;
  int initNQCount = localOpCount[OP_NQ];
  for (int i = 0; i < MAX_OP_ATTEMPTS[OP_P]; i++) {
    try {
      rtn = 0;
      if (VERBOSE) System.err.println("["+threadID+"] Getting portfolio for "+uid+"...");
      Collection holdingDataBeans = trade.getHoldings(uid);
      rtn += holdingDataBeans.hashCode();
      if (holdingDataBeans == null) {
        System.err.println("User "+uid+" has no holdings.");
      } else if (holdingDataBeans.size() > 0) {
        Iterator it = holdingDataBeans.iterator();
        HoldingDataBean holdingData = null;
        while (it.hasNext()) {
          holdingData = (HoldingDataBean) it.next();
          if (holdingData == null) {
            System.err.println("Collection contained null holding!");
          } else {
            rtn += doQuote(holdingData.getQuoteID(), true);
          }
        }
      }
      localOpCount[OP_P]++;
      return rtn;
    } catch (Exception e) {
      localOpCount[OP_NQ] = initNQCount;  // don't count aborted ops
      if (VERBOSE || i == MAX_OP_ATTEMPTS[OP_P] - 1) {
        System.err.println("Error getting portfolio for "+uid+": " + e.toString());
        e.printStackTrace();
      }
    }
  }
  return rtn;
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:36,代码来源:DaCapoTrader.java

示例2: compareTo

import java.util.Collection; //导入方法依赖的package包/类
/**
 * Compare this Sequence to another node.<br><br>
 * 
 * A Sequence is always considered greater than a Scalar and less than
 * a Mapping.<br>
 * 
 * If o is a Sequence, their integer lengths are compared - the one with
 * the greater length is considered greater. If the lengths are equal,
 * then the 2 Sequences are equal if all elements are equal. If the
 * elements are not identical, the comparison of the first unequal
 * elements is returned.
 * 
 * @param other The other AbstractNode.
 * @checkstyle NestedIfDepth (100 lines)
 * @return
 *  a value < 0 if this < o <br>
 *   0 if this == o or <br>
 *  a value > 0 if this > o
 */
@Override
public int compareTo(final YamlNode other) {
    int result = 0;
    if (other == null || other instanceof Scalar) {
        result = 1;
    } else if (other instanceof YamlMapping) {
        result = -1;
    } else if (this != other) {
        final Collection<YamlNode> nodes = this.children();
        nodes.hashCode();
        final Collection<YamlNode> others = other.children();
        if(nodes.size() > others.size()) {
            result = 1;
        } else if (nodes.size() < others.size()) {
            result = -1;
        } else {
            final Iterator<YamlNode> ietrator = others.iterator();
            final Iterator<YamlNode> here = nodes.iterator();
            while(ietrator.hasNext()) {
                result = here.next().compareTo(ietrator.next());
                if(result != 0) {
                    break;
                }
            }
        }
    }
    return result;
}
 
开发者ID:decorators-squad,项目名称:camel,代码行数:48,代码来源:AbstractYamlSequence.java

示例3: listHashCode

import java.util.Collection; //导入方法依赖的package包/类
private static int listHashCode(Collection<?> c) {
    return c == null || c.isEmpty() ? 0 : c.hashCode();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:CreateSymbols.java


注:本文中的java.util.Collection.hashCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。