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


Java TreeSet.descendingIterator方法代码示例

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


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

示例1: computeLatestAvailableVersionFromVersionSpec

import java.util.TreeSet; //导入方法依赖的package包/类
public static int computeLatestAvailableVersionFromVersionSpec(TreeSet<Integer> allAvailableFacebookAppVersions, int latestSdkVersion, int[] versionSpec) {
    int versionSpecIndex = versionSpec.length - 1;
    Iterator<Integer> fbAppVersionsIterator = allAvailableFacebookAppVersions.descendingIterator();
    int latestFacebookAppVersion = -1;
    while (fbAppVersionsIterator.hasNext()) {
        int fbAppVersion = ((Integer) fbAppVersionsIterator.next()).intValue();
        latestFacebookAppVersion = Math.max(latestFacebookAppVersion, fbAppVersion);
        while (versionSpecIndex >= 0 && versionSpec[versionSpecIndex] > fbAppVersion) {
            versionSpecIndex--;
        }
        if (versionSpecIndex < 0) {
            return -1;
        }
        if (versionSpec[versionSpecIndex] == fbAppVersion) {
            return versionSpecIndex % 2 == 0 ? Math.min(latestFacebookAppVersion, latestSdkVersion) : -1;
        }
    }
    return -1;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:20,代码来源:NativeProtocol.java

示例2: initScan

import java.util.TreeSet; //导入方法依赖的package包/类
private void initScan() {
  /* Get the associated Region with this table */
  Region tableRegion = null;
  if (isFtable) {
    tableRegion = ((ProxyFTableRegion) table).getTableRegion();
  } else {
    tableRegion = ((ProxyMTableRegion) table).getTableRegion();
  }
  this.rowProducer = ScanUtils.getRowProducer(scan, td);
  if (tableRegion == null) {
    /* this should never happen */
    throw new IllegalStateException("Scan could not get the handle of internal Handle");
  }
  /*
   * Cast this region to PartitionedRegion, As all our regions associated with the table is
   * Partitioned Region.
   */
  prDataStore = ((PartitionedRegion) tableRegion).getDataStore();

  prDataStore.getCachePerfStats().incScans();
  ((PartitionedRegion) tableRegion).getPrStats().incScanCount(1);

  TreeSet<Integer> bucketIdSet;
  int bucketId = scan.getBucketId();
  if (bucketId != -1) {
    bucketIdSet = new TreeSet<>();
    bucketIdSet.add(bucketId);
  } else {
    bucketIdSet = new TreeSet<>((scan.getBucketIds().size() > 0) ? scan.getBucketIds()
        : getApplicableLocalBucketIds(scan, td, prDataStore));
  }
  if (this.scan.isReversed()) {
    this.bucketIdIterator = bucketIdSet.descendingIterator();
  } else {
    this.bucketIdIterator = bucketIdSet.iterator();
  }
  try {
    this.scanContext = new ScanContext(null, tableRegion, this.scan, td, null, null);
  } catch (InterruptedException e) {
    logger.error("Failed to create scanContext " + e.getMessage());
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:43,代码来源:ScannerServerImpl.java


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