本文整理了Java中java.util.concurrent.LinkedBlockingDeque.peekFirst()
方法的一些代码示例,展示了LinkedBlockingDeque.peekFirst()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedBlockingDeque.peekFirst()
方法的具体详情如下:
包路径:java.util.concurrent.LinkedBlockingDeque
类名称:LinkedBlockingDeque
方法名:peekFirst
暂无
代码示例来源:origin: robovm/robovm
public E peek() {
return peekFirst();
}
代码示例来源:origin: robovm/robovm
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getFirst() {
E x = peekFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: azkaban/azkaban
/**
* Remove snapshots to maintain reporting interval
*
* @param metricName Name of the metric
* @param firstAllowedDate End date of the interval
*/
private void cleanUsingTime(final String metricName, final Date firstAllowedDate) {
if (this.historyListMapping.containsKey(metricName)
&& this.historyListMapping.get(metricName) != null) {
synchronized (this.historyListMapping.get(metricName)) {
InMemoryHistoryNode firstNode = this.historyListMapping.get(metricName).peekFirst();
long localCopyOfTimeWindow = 0;
// go ahead for clean up using latest possible value of interval
// any interval change will not affect on going clean up
synchronized (this) {
localCopyOfTimeWindow = this.timeWindow;
}
// removing objects older than Interval time from firstAllowedDate
while (firstNode != null
&& TimeUnit.MILLISECONDS
.toMillis(firstAllowedDate.getTime() - firstNode.getTimestamp().getTime())
> localCopyOfTimeWindow) {
this.historyListMapping.get(metricName).removeFirst();
firstNode = this.historyListMapping.get(metricName).peekFirst();
}
}
}
}
代码示例来源:origin: jankotek/mapdb
/**
* Returns a new deque of given size containing consecutive
* Integers 0 ... n - 1.
*/
private static LinkedBlockingDeque<Integer> populatedDeque(int n) {
LinkedBlockingDeque<Integer> q =
new LinkedBlockingDeque<Integer>(n);
assertTrue(q.isEmpty());
for (int i = 0; i < n; i++)
assertTrue(q.offer(new Integer(i)));
assertFalse(q.isEmpty());
assertEquals(0, q.remainingCapacity());
assertEquals(n, q.size());
assertEquals((Integer) 0, q.peekFirst());
assertEquals((Integer) (n - 1), q.peekLast());
return q;
}
代码示例来源:origin: numenta/htm.java
/**
* Retrieves, but does not remove, the first element of this deque, or
* returns null if this deque is empty.
*
* @return
*/
public E peekFirst() {
return backingList.peekFirst();
}
代码示例来源:origin: ibinti/bugvm
public E peek() {
return peekFirst();
}
代码示例来源:origin: com.gluonhq/robovm-rt
public E peek() {
return peekFirst();
}
代码示例来源:origin: com.netflix.dyno/dyno-core
public Bucket firstBucket() {
return queue.peekFirst();
}
}
代码示例来源:origin: MobiVM/robovm
public E peek() {
return peekFirst();
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getFirst() {
E x = peekFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getFirst() {
E x = peekFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: MobiVM/robovm
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getFirst() {
E x = peekFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: org.apidesign.bck2brwsr/emul
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getFirst() {
E x = peekFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: ibinti/bugvm
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getFirst() {
E x = peekFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: FlexoVM/flexovm
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getFirst() {
E x = peekFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getFirst() {
E x = peekFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getFirst() {
E x = peekFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: jtulach/bck2brwsr
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getFirst() {
E x = peekFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: com.netflix.dyno/dyno-core
private int compareWindow(long currentTimestamp) {
Long lastBucketTimestamp = queue.peekFirst().lastTimestamp.get();
return lastBucketTimestamp.compareTo(currentTimestamp);
}
代码示例来源:origin: com.netflix.dyno/dyno-core
private void syncToNewWindow(long timestamp) {
long currentTimestamp = queue.peekFirst().lastTimestamp.get();
if (currentTimestamp == timestamp) {
return;
}
while (currentTimestamp < timestamp) {
currentTimestamp++;
addNewBucket(currentTimestamp);
}
}
内容来源于网络,如有侵权,请联系作者删除!