本文整理匯總了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;
}
示例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());
}
}