本文整理了Java中java.util.ArrayDeque.peekLast()
方法的一些代码示例,展示了ArrayDeque.peekLast()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArrayDeque.peekLast()
方法的具体详情如下:
包路径:java.util.ArrayDeque
类名称:ArrayDeque
方法名:peekLast
暂无
代码示例来源:origin: google/google-java-format
/**
* Add a {@link Doc.Break} to the current {@link Doc.Level}.
*
* @param breakDoc the {@link Doc.Break}
*/
void breakDoc(Doc.Break breakDoc) {
appendLevel = stack.peekLast();
appendLevel.add(breakDoc);
}
代码示例来源:origin: google/google-java-format
/** Close the current {@link Doc.Level}. */
void close() {
Doc.Level top = stack.removeLast();
stack.peekLast().add(top);
}
代码示例来源:origin: wildfly/wildfly
@Override
public void endSequence() throws IllegalStateException {
EncoderState lastState = states.peekLast();
if ((lastState == null) || (lastState.getTag() != SEQUENCE_TYPE)) {
throw log.noSequenceToEnd();
}
endConstructedElement();
}
代码示例来源:origin: wildfly/wildfly
@Override
public void flush() {
while (states.size() != 0) {
EncoderState lastState = states.peekLast();
if (lastState.getTag() == SEQUENCE_TYPE) {
endSequence();
} else if (lastState.getTag() == SET_TYPE) {
endSet();
}
}
}
代码示例来源:origin: apache/flume
public void putPrimary(Integer eventCount) {
totalPuts += eventCount;
if ((queue.peekLast() == null) || queue.getLast().intValue() < 0) {
queue.addLast(new MutableInteger(eventCount));
} else {
queue.getLast().add(eventCount);
}
}
代码示例来源:origin: apache/flume
public void putOverflow(Integer eventCount) {
totalPuts += eventCount;
if ((queue.peekLast() == null) || queue.getLast().intValue() > 0) {
queue.addLast(new MutableInteger(-eventCount));
} else {
queue.getLast().add(-eventCount);
}
overflowCounter += eventCount;
}
代码示例来源:origin: wildfly/wildfly
@Override
public boolean hasNextElement() {
DecoderState lastState = states.peekLast();
boolean hasNext;
if (lastState != null) {
hasNext = ((bi.getIndex() < lastState.getNextElementIndex()) && hasCompleteElement());
} else {
hasNext = hasCompleteElement();
}
return hasNext;
}
代码示例来源:origin: wildfly/wildfly
private void startConstructedElement(int tag) {
EncoderState lastState = states.peekLast();
if ((lastState != null) && (lastState.getTag() == SET_TYPE)) {
updateCurrentBuffer();
lastState.addChildElement(tag, currentBufferPos);
}
writeTag(tag, currentBuffer);
if (tag != SET_TYPE) {
updateCurrentBuffer();
}
states.add(new EncoderState(tag, currentBufferPos));
}
代码示例来源:origin: wildfly/wildfly
@Override
public void endSet() throws ASN1Exception {
DecoderState lastState = states.peekLast();
if ((lastState == null) || (lastState.getTag() != SET_TYPE)) {
throw log.noSetToEnd();
}
endConstructedElement(lastState.getNextElementIndex());
states.removeLast();
}
代码示例来源:origin: wildfly/wildfly
@Override
public void endExplicit() throws IllegalStateException {
EncoderState lastState = states.peekLast();
if ((lastState == null) || (lastState.getTag() == SEQUENCE_TYPE)
|| (lastState.getTag() == SET_TYPE) || ((lastState.getTag() & CONSTRUCTED_MASK) == 0)) {
throw log.noExplicitlyTaggedElementToEnd();
}
endConstructedElement();
}
代码示例来源:origin: wildfly/wildfly
@Override
public void endSequence() throws ASN1Exception {
DecoderState lastState = states.peekLast();
if ((lastState == null) || (lastState.getTag() != SEQUENCE_TYPE)) {
throw log.noSequenceToEnd();
}
endConstructedElement(lastState.getNextElementIndex());
states.removeLast();
}
代码示例来源:origin: wildfly/wildfly
if (queue.peekLast() == first) {
代码示例来源:origin: wildfly/wildfly
private void endConstructedElement() {
ByteStringBuilder dest;
if (currentBufferPos > 0) {
// Output the element to its parent buffer
dest = buffers.get(currentBufferPos - 1);
} else {
// Output the element directly to the target destination
dest = target;
}
int length = currentBuffer.length();
int numLengthOctets = writeLength(length, dest);
dest.append(currentBuffer);
currentBuffer.setLength(0);
currentBuffer = dest;
currentBufferPos -= 1;
states.removeLast();
// If this element's parent element is a set element, update the parent's accumulated length
EncoderState lastState = states.peekLast();
if ((lastState != null) && (lastState.getTag() == SET_TYPE)) {
lastState.addChildLength(1 + numLengthOctets + length);
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public void endExplicit() throws ASN1Exception {
DecoderState lastState = states.peekLast();
if ((lastState == null) || (lastState.getTag() == SEQUENCE_TYPE)
|| (lastState.getTag() == SET_TYPE) || ((lastState.getTag() & CONSTRUCTED_MASK) == 0)) {
throw log.noExplicitlyTaggedElementToEnd();
}
endConstructedElement(lastState.getNextElementIndex());
states.removeLast();
}
代码示例来源:origin: wildfly/wildfly
private void endSet(Comparator<EncoderState> comparator) {
EncoderState lastState = states.peekLast();
if ((lastState == null) || (lastState.getTag() != SET_TYPE)) {
throw log.noSetToEnd();
lastState = states.peekLast();
if ((lastState != null) && (lastState.getTag() == SET_TYPE)) {
lastState.addChildLength(1 + numLengthOctets + childLength);
代码示例来源:origin: wildfly/wildfly
private void writeElement(int tag, byte[] contents) {
EncoderState lastState = states.peekLast();
if ((lastState != null) && (lastState.getTag() == SET_TYPE)) {
updateCurrentBuffer();
lastState.addChildElement(tag, currentBufferPos);
}
writeTag(tag, currentBuffer);
writeLength(contents.length, currentBuffer);
currentBuffer.append(contents);
// If this element's parent element is a set element, update the parent's accumulated length
if ((lastState != null) && (lastState.getTag() == SET_TYPE)) {
lastState.addChildLength(currentBuffer.length());
}
}
代码示例来源:origin: wildfly/wildfly
private void writeElement(int tag, ByteStringBuilder contents) {
EncoderState lastState = states.peekLast();
if ((lastState != null) && (lastState.getTag() == SET_TYPE)) {
updateCurrentBuffer();
lastState.addChildElement(tag, currentBufferPos);
}
writeTag(tag, currentBuffer);
writeLength(contents.length(), currentBuffer);
currentBuffer.append(contents);
// If this element's parent element is a set element, update the parent's accumulated length
if ((lastState != null) && (lastState.getTag() == SET_TYPE)) {
lastState.addChildLength(currentBuffer.length());
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public void writeEncoded(byte[] encoded) {
EncoderState lastState = states.peekLast();
if ((lastState != null) && (lastState.getTag() == SET_TYPE)) {
updateCurrentBuffer();
lastState.addChildElement(encoded[0], currentBufferPos);
}
if (implicitTag != -1) {
writeTag(encoded[0], currentBuffer);
currentBuffer.append(encoded, 1, encoded.length - 1);
} else {
currentBuffer.append(encoded);
}
// If this element's parent element is a set element, update the parent's accumulated length
if ((lastState != null) && (lastState.getTag() == SET_TYPE)) {
lastState.addChildLength(currentBuffer.length());
}
}
代码示例来源:origin: pravega/pravega
private ContainerMetadataUpdateTransaction getActiveTransaction() {
if (this.transactions.isEmpty()) {
return null;
}
ContainerMetadataUpdateTransaction last = this.transactions.peekLast();
if (last.isSealed()) {
return null;
} else {
return last;
}
}
代码示例来源:origin: org.wildfly.security/wildfly-elytron
@Override
public void endExplicit() throws ASN1Exception {
DecoderState lastState = states.peekLast();
if ((lastState == null) || (lastState.getTag() == SEQUENCE_TYPE)
|| (lastState.getTag() == SET_TYPE) || ((lastState.getTag() & CONSTRUCTED_MASK) == 0)) {
throw log.noExplicitlyTaggedElementToEnd();
}
endConstructedElement(lastState.getNextElementIndex());
states.removeLast();
}
内容来源于网络,如有侵权,请联系作者删除!