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


Java TreeSet.equals方法代码示例

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


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

示例1: waitForAllExpectationsToBeSatisfied

import java.util.TreeSet; //导入方法依赖的package包/类
public boolean waitForAllExpectationsToBeSatisfied(int timeoutSeconds) {
  // TODO(fischman): problems with this approach:
  // - come up with something better than a poll loop
  // - avoid serializing expectations explicitly; the test is not as robust
  //   as it could be because it must place expectations between wait
  //   statements very precisely (e.g. frame must not arrive before its
  //   expectation, and expectation must not be registered so early as to
  //   stall a wait).  Use callbacks to fire off dependent steps instead of
  //   explicitly waiting, so there can be just a single wait at the end of
  //   the test.
  long endTime = System.currentTimeMillis() + 1000 * timeoutSeconds;
  TreeSet<String> prev = null;
  TreeSet<String> stillWaitingForExpectations = unsatisfiedExpectations();
  while (!stillWaitingForExpectations.isEmpty()) {
    if (!stillWaitingForExpectations.equals(prev)) {
      System.out.println(name + " still waiting at\n    " + (new Throwable()).getStackTrace()[1]
          + "\n    for: " + Arrays.toString(stillWaitingForExpectations.toArray()));
    }
    if (endTime < System.currentTimeMillis()) {
      System.out.println(name + " timed out waiting for: "
          + Arrays.toString(stillWaitingForExpectations.toArray()));
      return false;
    }
    try {
      Thread.sleep(10);
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
    prev = stillWaitingForExpectations;
    stillWaitingForExpectations = unsatisfiedExpectations();
  }
  if (prev == null) {
    System.out.println(
        name + " didn't need to wait at\n    " + (new Throwable()).getStackTrace()[1]);
  }
  return true;
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:38,代码来源:PeerConnectionTest.java


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