當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。