本文整理了Java中java.util.TreeSet.headSet()
方法的一些代码示例,展示了TreeSet.headSet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TreeSet.headSet()
方法的具体详情如下:
包路径:java.util.TreeSet
类名称:TreeSet
方法名:headSet
[英]Returns a SortedSet of the specified portion of this TreeSet which contains elements less than the end element. The returned SortedSet is backed by this TreeSet so changes to one are reflected by the other.
[中]返回此树集的指定部分的SortedSet,其中包含的元素少于end元素。返回的SortedSet由该树集支持,因此对其中一个树集的更改由另一个树集反映。
代码示例来源:origin: robovm/robovm
/**
* Returns a {@code SortedSet} of the specified portion of this {@code TreeSet} which
* contains elements less than the end element. The returned SortedSet is
* backed by this TreeSet so changes to one are reflected by the other.
*
* @param end
* the end element
* @return a subset where the elements are less than <code>end</code>
*
* @exception ClassCastException
* when the end object cannot be compared with the elements
* in this TreeSet
* @exception NullPointerException
* when the end object is null and the comparator cannot
* handle null
*/
@SuppressWarnings("unchecked")
public SortedSet<E> headSet(E end) {
return headSet(end, false);
}
代码示例来源:origin: goldmansachs/gs-collections
public int indexOf(Object object)
{
if (this.treeSet.contains(object))
{
return this.treeSet.headSet((T) object).size();
}
return -1;
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public int indexOf(Object object)
{
if (this.treeSet.contains(object))
{
return this.treeSet.headSet((T) object).size();
}
return -1;
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public int indexOf(Object object)
{
if (this.treeSet.contains(object))
{
return this.treeSet.headSet((T) object).size();
}
return -1;
}
代码示例来源:origin: atomix/atomix
@Override
public NavigableSet<E> headSet(E toElement, boolean inclusive) {
return set().headSet(toElement, inclusive);
}
代码示例来源:origin: atomix/atomix
@Override
public SortedSet<E> headSet(E toElement) {
return set().headSet(toElement);
}
代码示例来源:origin: goldmansachs/gs-collections
public MutableSortedSet<T> headSet(T toElement)
{
return SortedSetAdapter.adapt(this.treeSet.headSet(toElement));
}
代码示例来源:origin: alibaba/jstorm
private void removeObsoleteBatches(long commitBatchId) {
TreeSet<Long> totalBatches = new TreeSet<Long>(batchXorTracker.getBatchIds());
Set<Long> obsoleteBatches = totalBatches.headSet(commitBatchId);
if (obsoleteBatches != null && obsoleteBatches.size() > 0) {
LOG.info("Remove obsolete batches: {}", obsoleteBatches);
for (Long batchId : obsoleteBatches) {
batchXorTracker.removeBatch(batchId);
}
}
}
}
代码示例来源:origin: alibaba/jstorm
private void removeObsoleteBatches(long commitBatchId) {
TreeSet<Long> totalBatches = new TreeSet<Long>(tracker.getBatchIds());
Set<Long> obsoleteBatches = totalBatches.headSet(commitBatchId);
if (obsoleteBatches != null && obsoleteBatches.size() > 0) {
LOG.info("Remove obsolete batches: {}", obsoleteBatches);
for (Long batchId : obsoleteBatches) {
tracker.removeBatch(batchId);
}
}
}
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public MutableSortedSet<T> headSet(T toElement)
{
return SortedSetAdapter.adapt(this.treeSet.headSet(toElement));
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public MutableSortedSet<T> headSet(T toElement)
{
return SortedSetAdapter.adapt(this.treeSet.headSet(toElement));
}
代码示例来源:origin: apache/hbase
public ReturnCode filterColumn(Cell cell) {
byte [] qualifier = CellUtil.cloneQualifier(cell);
TreeSet<byte []> lesserOrEqualPrefixes =
(TreeSet<byte []>) sortedPrefixes.headSet(qualifier, true);
if (lesserOrEqualPrefixes.size() != 0) {
byte [] largestPrefixSmallerThanQualifier = lesserOrEqualPrefixes.last();
if (Bytes.startsWith(qualifier, largestPrefixSmallerThanQualifier)) {
return ReturnCode.INCLUDE;
}
if (lesserOrEqualPrefixes.size() == sortedPrefixes.size()) {
return ReturnCode.NEXT_ROW;
} else {
hint = sortedPrefixes.higher(largestPrefixSmallerThanQualifier);
return ReturnCode.SEEK_NEXT_USING_HINT;
}
} else {
hint = sortedPrefixes.first();
return ReturnCode.SEEK_NEXT_USING_HINT;
}
}
代码示例来源:origin: ChinaSilence/any-video
for (; node != null; node = node.next) {
if (node.headTwoCharMix == mix) {
NavigableSet<StringPointer> desSet = node.words.headSet(sp.substring(i), true);
for (StringPointer word : desSet.descendingSet()) {
if (sp.nextStartsWith(i, word)) {
代码示例来源:origin: apache/usergrid
return uuid_set.headSet( finish_uuid ).tailSet( start_uuid );
代码示例来源:origin: resteasy/Resteasy
@Override
public NavigableSet<E> headSet(E toElement, boolean inclusive) {
return new UnmodifiableTreeSet<>(super.headSet(toElement, inclusive));
}
代码示例来源:origin: resteasy/Resteasy
@Override
public SortedSet<E> headSet(E toElement) {
return new UnmodifiableTreeSet<>(super.headSet(toElement));
}
代码示例来源:origin: org.apache.hbase/hbase-client
public ReturnCode filterColumn(Cell cell) {
byte [] qualifier = CellUtil.cloneQualifier(cell);
TreeSet<byte []> lesserOrEqualPrefixes =
(TreeSet<byte []>) sortedPrefixes.headSet(qualifier, true);
if (lesserOrEqualPrefixes.size() != 0) {
byte [] largestPrefixSmallerThanQualifier = lesserOrEqualPrefixes.last();
if (Bytes.startsWith(qualifier, largestPrefixSmallerThanQualifier)) {
return ReturnCode.INCLUDE;
}
if (lesserOrEqualPrefixes.size() == sortedPrefixes.size()) {
return ReturnCode.NEXT_ROW;
} else {
hint = sortedPrefixes.higher(largestPrefixSmallerThanQualifier);
return ReturnCode.SEEK_NEXT_USING_HINT;
}
} else {
hint = sortedPrefixes.first();
return ReturnCode.SEEK_NEXT_USING_HINT;
}
}
代码示例来源:origin: ron190/jsql-injection
workingSet = this.iniPositions.headSet(startRequest);
代码示例来源:origin: org.apache.openejb.patch/openjpa-kernel
@Override
public SortedSet headSet(Object toElement) {
if (!_directAccess && isDelayLoad()) {
load();
}
return super.headSet(toElement);
}
代码示例来源:origin: pravega/pravega
@Override
public void removeTruncationMarkers(long upToOperationSequenceNumber) {
synchronized (this.truncationMarkers) {
this.truncationMarkers.headMap(upToOperationSequenceNumber, true).clear();
this.truncationPoints.headSet(upToOperationSequenceNumber, true).clear();
}
this.lastTruncatedSequenceNumber.set(upToOperationSequenceNumber);
}
内容来源于网络,如有侵权,请联系作者删除!