本文整理汇总了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());
}
}