java.util.LinkedList.peekLast()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(236)

本文整理了Java中java.util.LinkedList.peekLast()方法的一些代码示例,展示了LinkedList.peekLast()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedList.peekLast()方法的具体详情如下:
包路径:java.util.LinkedList
类名称:LinkedList
方法名:peekLast

LinkedList.peekLast介绍

[英]Retrieves, but does not remove, the last element of this list, or returns null if this list is empty.
[中]检索但不删除此列表的最后一个元素,如果此列表为空,则返回null。

代码示例

代码示例来源:origin: org.mongodb/mongo-java-driver

/**
 * Gets the name of the current field
 *
 * @return the name of the current field.
 */
protected String curName() {
  return nameStack.peekLast();
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public void write(int datum) throws IOException {
  if (this.closed) {
    throw new IOException("Stream closed");
  }
  else {
    if (this.buffers.peekLast() == null || this.buffers.getLast().length == this.index) {
      addBuffer(1);
    }
    // store the byte
    this.buffers.getLast()[this.index++] = (byte) datum;
  }
}

代码示例来源:origin: Bilibili/DanmakuFlameMaster

@Override
public BaseDanmaku last() {
  if (items != null && !items.isEmpty()) {
    if (mSortType == ST_BY_LIST) {
      return ((LinkedList<BaseDanmaku>) items).peekLast();
    }
    return ((SortedSet<BaseDanmaku>) items).last();
  }
  return null;
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Create a new buffer and store it in the LinkedList
 * <p>Adds a new buffer that can store at least {@code minCapacity} bytes.
 */
private void addBuffer(int minCapacity) {
  if (this.buffers.peekLast() != null) {
    this.alreadyBufferedSize += this.index;
    this.index = 0;
  }
  if (this.nextBlockSize < minCapacity) {
    this.nextBlockSize = nextPowerOf2(minCapacity);
  }
  this.buffers.add(new byte[this.nextBlockSize]);
  this.nextBlockSize *= 2;  // block size doubles each time
}

代码示例来源:origin: apache/hive

public E peekLast() {
 lock.lock();
 try {
  return list.size() == 0 ? null : list.peekLast();
 } finally {
  lock.unlock();
 }
}

代码示例来源:origin: Netflix/zuul

public PassportState getState()
{
  return history.peekLast().getState();
}

代码示例来源:origin: Bilibili/DanmakuFlameMaster

private synchronized long getAverageRenderingTime() {
  int frames = mDrawTimes.size();
  if(frames <= 0)
    return 0;
  Long first = mDrawTimes.peekFirst();
  Long last = mDrawTimes.peekLast();
  if (first == null || last == null) {
    return 0;
  }
  long dtime = last - first;
  return dtime / frames;
}

代码示例来源:origin: org.springframework/spring-core

@Override
public void write(int datum) throws IOException {
  if (this.closed) {
    throw new IOException("Stream closed");
  }
  else {
    if (this.buffers.peekLast() == null || this.buffers.getLast().length == this.index) {
      addBuffer(1);
    }
    // store the byte
    this.buffers.getLast()[this.index++] = (byte) datum;
  }
}

代码示例来源:origin: apache/pulsar

public boolean add(MessageId messageId) {
  writeLock.lock();
  try {
    ConcurrentOpenHashSet<MessageId> partition = timePartitions.peekLast();
    messageIdPartitionMap.put(messageId, partition);
    return partition.add(messageId);
  } finally {
    writeLock.unlock();
  }
}

代码示例来源:origin: org.springframework/spring-core

/**
 * Create a new buffer and store it in the LinkedList
 * <p>Adds a new buffer that can store at least {@code minCapacity} bytes.
 */
private void addBuffer(int minCapacity) {
  if (this.buffers.peekLast() != null) {
    this.alreadyBufferedSize += this.index;
    this.index = 0;
  }
  if (this.nextBlockSize < minCapacity) {
    this.nextBlockSize = nextPowerOf2(minCapacity);
  }
  this.buffers.add(new byte[this.nextBlockSize]);
  this.nextBlockSize *= 2;  // block size doubles each time
}

代码示例来源:origin: spring-projects/spring-framework

if (this.buffers.peekLast() == null || this.buffers.getLast().length == this.index) {
  addBuffer(length);

代码示例来源:origin: apache/hbase

public MemStoreSize getTailSize() {
 LinkedList<? extends Segment> localCopy = readOnlyCopy;
 return localCopy.isEmpty()? new MemStoreSize(): localCopy.peekLast().getMemStoreSize();
}

代码示例来源:origin: org.springframework/spring-core

if (this.buffers.peekLast() == null || this.buffers.getLast().length == this.index) {
  addBuffer(length);

代码示例来源:origin: cmusphinx/sphinx4

private MixtureComponentSetScores getStoredScores(long frameFirstSample) {
  if (storedScores.isEmpty())
    return null;
  if (storedScores.peekLast().getFrameStartSample() < frameFirstSample)
    //new frame
    return null;
  for (MixtureComponentSetScores scores : storedScores) {
    if (scores.getFrameStartSample() == frameFirstSample)
      return scores;
  }
  //Failed to find score. Seems it wasn't calculated yet
  return null;
}

代码示例来源:origin: weibocom/motan

int len = result1.length();
while (outer.size() > 0 && i < len) {
  LinkedList<Character> sub = outer.peekLast();
  while (sub.size() > 0 && i < len) {
    char curr = result1.charAt(i++);
  throw new IllegalArgumentException("语法错误, 可能圆括号没有闭合");
char result = evalWithinParentheses(outer.peekLast());
return result == '1';

代码示例来源:origin: Netflix/zuul

public PassportState getState()
{
  return history.peekLast().getState();
}

代码示例来源:origin: geoserver/geoserver

LayerInfo createLayer(ResourceInfo r, String name, NamespaceInfo ns) {
  String lId = newId();
  StyleInfo s = styles.peekLast();

代码示例来源:origin: geoserver/geoserver

public MockCatalogBuilder dataStore(String name) {
  String dsId = newId();
  final WorkspaceInfo ws = workspaces.peekLast();
  final NamespaceInfo ns = namespaces.peekLast();

代码示例来源:origin: geoserver/geoserver

public MockCatalogBuilder coverageStore(String name, String filename, String format) {
  String csId = newId();
  WorkspaceInfo ws = workspaces.peekLast();
  NamespaceInfo ns = namespaces.peekLast();

代码示例来源:origin: geoserver/geoserver

final DataStoreInfo ds = dataStores.peekLast();
NamespaceInfo ns = namespaces.peekLast();

相关文章