本文整理了Java中java.util.Deque.getFirst()
方法的一些代码示例,展示了Deque.getFirst()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Deque.getFirst()
方法的具体详情如下:
包路径:java.util.Deque
类名称:Deque
方法名:getFirst
[英]Retrieves, but does not remove, the first element of this deque. This method differs from #peekFirst only in that it throws an exception if this deque is empty.
[中]检索但不删除此数据块的第一个元素。此方法与#peek first的不同之处在于,如果此deque为空,则会引发异常。
代码示例来源:origin: google/j2objc
@Override
public E getFirst() {
synchronized (mutex) {
return delegate().getFirst();
}
}
代码示例来源:origin: btraceio/btrace
@Override
public synchronized V getFirst() {
return delegate.getFirst();
}
代码示例来源:origin: google/guava
@Override
public E getFirst() {
synchronized (mutex) {
return delegate().getFirst();
}
}
代码示例来源:origin: google/guava
@Override
public E getFirst() {
return delegate().getFirst();
}
代码示例来源:origin: Atmosphere/atmosphere
@Override
public boolean ready() throws IOException {
// assuming no other thread is concurrently reading
if (readers.isEmpty()) {
return false;
}
return readers.getFirst().ready();
}
代码示例来源:origin: prestodb/presto
@Override
public E getFirst() {
synchronized (mutex) {
return delegate().getFirst();
}
}
代码示例来源:origin: prestodb/presto
@Override
public E getFirst() {
return delegate().getFirst();
}
代码示例来源:origin: google/j2objc
@Override
public E getFirst() {
return delegate().getFirst();
}
代码示例来源:origin: google/guava
@Override
public E getFirst() {
assertTrue(Thread.holdsLock(mutex));
return delegate.getFirst();
}
代码示例来源:origin: SonarSource/sonarqube
@Override
public T current() {
return deque.getFirst().getElement();
}
代码示例来源:origin: wildfly/wildfly
@Override
public E getFirst() {
synchronized (mutex) {
return delegate().getFirst();
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public String findSessionId(final HttpServerExchange exchange) {
Deque<String> stringDeque = exchange.getPathParameters().get(name);
if (stringDeque == null) {
return null;
}
UndertowLogger.SESSION_LOGGER.tracef("Found path parameter session id %s on %s", stringDeque.getFirst(), exchange);
return stringDeque.getFirst();
}
代码示例来源:origin: apache/hive
@Override
public Builder startOr() {
ExpressionTree node = new ExpressionTree(ExpressionTree.Operator.OR);
currentTree.getFirst().getChildren().add(node);
currentTree.addFirst(node);
return this;
}
代码示例来源:origin: apache/hive
@Override
public Builder startNot() {
ExpressionTree node = new ExpressionTree(ExpressionTree.Operator.NOT);
currentTree.getFirst().getChildren().add(node);
currentTree.addFirst(node);
return this;
}
代码示例来源:origin: apache/kafka
/**
* Get a list of batches which have been sitting in the accumulator too long and need to be expired.
*/
public List<ProducerBatch> expiredBatches(long now) {
List<ProducerBatch> expiredBatches = new ArrayList<>();
for (Map.Entry<TopicPartition, Deque<ProducerBatch>> entry : this.batches.entrySet()) {
// expire the batches in the order of sending
Deque<ProducerBatch> deque = entry.getValue();
synchronized (deque) {
while (!deque.isEmpty()) {
ProducerBatch batch = deque.getFirst();
if (batch.hasReachedDeliveryTimeout(deliveryTimeoutMs, now)) {
deque.poll();
batch.abortRecordAppends();
expiredBatches.add(batch);
} else {
maybeUpdateNextBatchExpiryTime(batch);
break;
}
}
}
}
return expiredBatches;
}
代码示例来源:origin: apache/hive
@Override
public Builder startAnd() {
ExpressionTree node = new ExpressionTree(ExpressionTree.Operator.AND);
currentTree.getFirst().getChildren().add(node);
currentTree.addFirst(node);
return this;
}
代码示例来源:origin: apache/hive
@Override
public Builder literal(TruthValue truth) {
ExpressionTree parent = currentTree.getFirst();
parent.getChildren().add(new ExpressionTree(truth));
return this;
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Eat an identifier, possibly qualified (meaning that it is dotted).
* TODO AndyC Could create complete identifiers (a.b.c) here rather than a sequence of them? (a, b, c)
*/
private SpelNodeImpl eatPossiblyQualifiedId() {
Deque<SpelNodeImpl> qualifiedIdPieces = new ArrayDeque<>();
Token node = peekToken();
while (isValidQualifiedId(node)) {
nextToken();
if (node.kind != TokenKind.DOT) {
qualifiedIdPieces.add(new Identifier(node.stringValue(), node.startPos, node.endPos));
}
node = peekToken();
}
if (qualifiedIdPieces.isEmpty()) {
if (node == null) {
throw internalException( this.expressionString.length(), SpelMessage.OOD);
}
throw internalException(node.startPos, SpelMessage.NOT_EXPECTED_TOKEN,
"qualified ID", node.getKind().toString().toLowerCase());
}
return new QualifiedIdentifier(qualifiedIdPieces.getFirst().getStartPosition(),
qualifiedIdPieces.getLast().getEndPosition(), qualifiedIdPieces.toArray(new SpelNodeImpl[0]));
}
代码示例来源:origin: apache/hive
@Override
public Builder isNull(String column, PredicateLeaf.Type type) {
ExpressionTree parent = currentTree.getFirst();
if (column == null) {
parent.getChildren().add(new ExpressionTree(TruthValue.YES_NO_NULL));
} else {
PredicateLeaf leaf =
new PredicateLeafImpl(PredicateLeaf.Operator.IS_NULL,
type, column, null, null, conf);
parent.getChildren().add(new ExpressionTree(addLeaf(leaf)));
}
return this;
}
代码示例来源:origin: google/guava
create().pollFirst();
create().pollLast();
create().getFirst();
create().getLast();
create().peekFirst();
内容来源于网络,如有侵权,请联系作者删除!