本文整理了Java中java.util.TreeSet.first()
方法的一些代码示例,展示了TreeSet.first()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TreeSet.first()
方法的具体详情如下:
包路径:java.util.TreeSet
类名称:TreeSet
方法名:first
[英]Returns the first element in this set.
[中]返回此集合中的第一个元素。
代码示例来源:origin: apache/storm
public String getDescription() {
final int size = data.size();
if (size > 0) {
final TimeData first = data.first();
final TimeData last = data.last();
return "Total " + size + " items: " + first + " to " + last;
}
return "Total " + size + " items.";
}
代码示例来源:origin: apache/hbase
private void init() {
if (this.timestamps.size() > 0) {
minTimestamp = this.timestamps.first();
}
}
代码示例来源:origin: sonyxperiadev/ApkAnalyser
/**
* Is this instruction a "beginning instruction". A beginning instruction is defined to be an instruction
* that can be the first successfully executed instruction in the method. The first instruction is always a
* beginning instruction. If the first instruction can throw an exception, and is covered by a try block, then
* the first instruction of any exception handler for that try block is also a beginning instruction. And likewise,
* if any of those instructions can throw an exception and are covered by try blocks, the first instruction of the
* corresponding exception handler is a beginning instruction, etc.
*
* To determine this, we simply check if the first predecessor is the fake "StartOfMethod" instruction, which has
* an instruction index of -1.
* @return a boolean value indicating whether this instruction is a beginning instruction
*/
public boolean isBeginningInstruction() {
//if this instruction has no predecessors, it is either the fake "StartOfMethod" instruction or it is an
//unreachable instruction.
if (predecessors.size() == 0) {
return false;
}
if (predecessors.first().instructionIndex == -1) {
return true;
}
return false;
}
代码示例来源:origin: apache/kylin
@Override
public String next() {
String r = input.next();
if (cache.size() < card) {
cache.add(r);
return r;
}
r = cache.floor(r);
return r == null ? cache.first() : r;
}
}
代码示例来源:origin: Sable/soot
/**
* Computes approximative types. The work list must be initialized with all constant type variables.
*/
public static void computeApprox(TreeSet<TypeVariableBV> workList) throws TypeException {
while (workList.size() > 0) {
TypeVariableBV var = workList.first();
workList.remove(var);
var.fixApprox(workList);
}
}
代码示例来源:origin: Sable/soot
/**
* Computes approximative types. The work list must be initialized with all constant type variables.
*/
public static void computeApprox(TreeSet<TypeVariable> workList) throws TypeException {
while (workList.size() > 0) {
TypeVariable var = workList.first();
workList.remove(var);
var.fixApprox(workList);
}
}
代码示例来源:origin: Sable/soot
/**
* Computes approximative types. The work list must be initialized with all constant type variables.
*/
public static void computeApprox(TreeSet<TypeVariable> workList) throws TypeException {
while (workList.size() > 0) {
TypeVariable var = workList.first();
workList.remove(var);
var.fixApprox(workList);
}
}
代码示例来源:origin: Sable/soot
public static void computeInvApprox(TreeSet<TypeVariable> workList) throws TypeException {
while (workList.size() > 0) {
TypeVariable var = workList.first();
workList.remove(var);
var.fixInvApprox(workList);
}
}
代码示例来源:origin: apache/storm
@Override
protected String getCompletedOffset() {
String offset = null;
if (pending.size() > 0) {
//find the smallest offset in pending list
offset = pending.keySet().iterator().next();
}
if (toResend.size() > 0) {
//find the smallest offset in toResend list
String offset2 = toResend.first().getMessageId().getOffset();
if (offset == null || offset2.compareTo(offset) < 0) {
offset = offset2;
}
}
if (offset == null) {
offset = lastOffset;
}
return offset;
}
}
代码示例来源:origin: thinkaurelius/titan
CacheEntry<Long, V> ce = entry.getValue();
ce.lastAccessedCopy = ce.lastAccessed;
if (tree.size() < n) {
tree.add(ce);
} else {
if (ce.lastAccessedCopy < tree.first().lastAccessedCopy) {
tree.remove(tree.first());
tree.add(ce);
代码示例来源:origin: prestodb/presto
private Optional<Object> getLowestValue()
{
return nonNullValues.size() > 0 ? Optional.of(nonNullValues.first()) : Optional.empty();
}
代码示例来源:origin: prestodb/presto
private Optional<Object> getLowestValue()
{
return nonNullValues.size() > 0 ? Optional.of(nonNullValues.first()) : Optional.empty();
}
代码示例来源:origin: JanusGraph/janusgraph
CacheEntry<Long, V> ce = entry.getValue();
ce.lastAccessedCopy = ce.lastAccessed;
if (tree.size() < n) {
tree.add(ce);
} else {
if (ce.lastAccessedCopy < tree.first().lastAccessedCopy) {
tree.remove(tree.first());
tree.add(ce);
代码示例来源:origin: FudanNLP/fnlp
/**
* 得到字符串类型
* @param str
* @return
* @see Chars#char2StringType(CharType)
*/
public static StringType getStringType(String str) {
TreeSet<CharType> set = getTypeSet(str);
if(set.size()==1){
CharType c = set.first();
return char2StringType(c);
}
return StringType.M;
}
/**
代码示例来源:origin: apache/ignite
return null;
else {
Long min = archiveIndices.first();
Long max = archiveIndices.last();
if (max - min == archiveIndices.size() - 1)
return F.t(min, max); // Short path.
代码示例来源:origin: apache/storm
private synchronized void trimHead() {
if (offsets.size() <= 1) {
return;
}
FileOffset head = offsets.first();
FileOffset head2 = offsets.higher(head);
if (head.isNextOffset(head2)) {
offsets.pollFirst();
trimHead();
}
return;
}
代码示例来源: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: apache/hive
if (ks.size() <= 1) {
List<String> oneList = new ArrayList<String>(1);
if (ks.size() == 1) {
oneList.add(ks.first());
new ArrayList<Operator<? extends OperatorDesc>>(ks.size());
List<List<ExprNodeDesc>> newSprayKeyLists = new ArrayList<List<ExprNodeDesc>>(ks.size());
代码示例来源:origin: apache/usergrid
static TreeSet<UUID> add( TreeSet<UUID> a, UUID uuid, boolean reversed, int limit ) {
if ( a == null ) {
a = new TreeSet<UUID>( new UUIDComparator() );
}
if ( uuid == null ) {
return a;
}
// if we have less than the limit, just add it
if ( a.size() < limit ) {
a.add( uuid );
}
else if ( reversed ) {
// if reversed, we want to add more recent messages
// and eject the oldest
if ( UUIDComparator.staticCompare( uuid, a.first() ) > 0 ) {
a.pollFirst();
a.add( uuid );
}
}
else {
// add older messages and eject the newset
if ( UUIDComparator.staticCompare( uuid, a.last() ) < 0 ) {
a.pollLast();
a.add( uuid );
}
}
return a;
}
代码示例来源:origin: alibaba/jstorm
if (sequenceNumbers.size() == 1) {
if (sequenceNumbers.first() < currentSeqNumber) {
incrementMaxSequenceNumber(zkClient, currentSeqNumber);
return currentSeqNumber + 1;
} else {
incrementMaxSequenceNumber(zkClient, currentSeqNumber);
return sequenceNumbers.first() + 1;
内容来源于网络,如有侵权,请联系作者删除!