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

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

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

LinkedList.pollFirst介绍

[英]Retrieves and removes the first element of this list, or returns null if this list is empty.
[中]检索并删除此列表的第一个元素,如果此列表为空,则返回null。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public Object[] getRow() {
 Object[] retRow = buffer.pollFirst();
 return retRow;
}

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

/**
 * Removes and returns first element, or null if empty.
 *
 * @return The removed element.
 */
private E innerRemoveFirst() {
 E f = list.pollFirst();
 if (f == null)
  return null;
 notFull.signal();
 return f;
}

代码示例来源:origin: ltsopensource/light-task-scheduler

public JobPo pollFirst() {
  lock.lock();
  try {
    JobPo f = list.pollFirst();
    if (f == null)
      return null;
    jobs.remove(f.getJobId());
    return f;
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: ltsopensource/light-task-scheduler

public JobPo pollFirst() {
  lock.lock();
  try {
    JobPo f = list.pollFirst();
    if (f == null)
      return null;
    jobs.remove(f.getJobId());
    return f;
  } finally {
    lock.unlock();
  }
}

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

/** {@inheritDoc} */
@Override public synchronized void evictDataPage() throws IgniteCheckedException {
  evictDataPage(pageUsageList.pollFirst());
}

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

private void emitNewRecord (SpoutOutputCollector collector) {
  for (Map.Entry<String, LinkedList<Record>> entry: toEmitPerShard.entrySet()) {
    String shardId = entry.getKey();
    LinkedList<Record> listOfRecords = entry.getValue();
    Record record;
    while ((record = listOfRecords.pollFirst()) != null) {
      KinesisMessageId kinesisMessageId = new KinesisMessageId(kinesisConfig.getStreamName(), shardId, record.getSequenceNumber());
      if (emitRecord(collector, record, kinesisMessageId)) {
        return;
      }
    }
  }
}

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

Object r = queue.pollFirst();
List<Object> childrens = getChildrens(w, r);

代码示例来源:origin: prestodb/presto

Long id = queue.pollFirst();
resourceGroupIdTemplateMap.computeIfAbsent(id, k -> {
  ResourceGroupSpecBuilder builder = recordMap.get(id);

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

private List<String> listPathsRecursive(FileSystem fs, Path path) throws IOException {
 List<String> paths = new ArrayList<>();
 LinkedList<Path> queue = new LinkedList<>();
 queue.add(path);
 while (!queue.isEmpty()) {
  Path next = queue.pollFirst();
  FileStatus[] stats = fs.listStatus(next, AcidUtils.hiddenFileFilter);
  for (FileStatus stat : stats) {
   Path child = stat.getPath();
   paths.add(child.toString());
   if (stat.isDirectory()) {
    queue.add(child);
   }
  }
 }
 return paths;
}

代码示例来源:origin: oracle/helidon

@SuppressWarnings("unchecked")
private void nextNoCheck(Throwable t) {
  LOGGER.finest(() -> "(reqID: " + requestId() + ") Routing error: " + t.getClass());
  for (ErrorHandlerRecord<?> record = errorHandlers.pollFirst(); record != null; record = errorHandlers.pollFirst()) {
    if (record.exceptionClass.isAssignableFrom(t.getClass())) {
      ErrorRoutedRequest nextErrorRequest = new ErrorRoutedRequest(errorHandlers, t);
      requestSpan.log(CollectionsHelper.mapOf("event", "error-handler",
                  "handler.class", record.errorHandler.getClass().getName(),
                  "handled.error.message", t.toString()));
      try {
        // there's no way to avoid this cast
        ((ErrorHandler<Throwable>) record.errorHandler).accept(nextErrorRequest, response, t);
      } catch (Throwable e) {
        // when an exception is thrown in an error handler, the original exception is only logged
        // the rest of the error handlers is skipped and the new exception is sent directly to the
        // default error handler.
        LOGGER.log(Level.WARNING,
              "Exception unexpectedly thrown from an error handler. Error handling of this logged "
                  + "exception was aborted.",
              t);
        defaultHandler(new IllegalStateException("Unexpected exception encountered during error handling.", e));
        return;
      }
      return;
    }
  }
  defaultHandler(t);
}

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

elementCycleCount--;
LocatableInputSplitWithCount split = splits.pollFirst();
if (unassignedSplits.contains(split)) {
  int localCount = split.getLocalCount();

代码示例来源:origin: oracle/opengrok

LinkedList<Group> stack = new LinkedList<>(conf.groups);
while (!stack.isEmpty()) {
  Group group = stack.pollFirst();
  stack.addAll(group.getSubgroups());

代码示例来源:origin: medcl/elasticsearch-analysis-ik

/**
 * 返回lexeme 
 * 
 * 同时处理合并
 * @return
 */
Lexeme getNextLexeme(){
  //从结果集取出,并移除第一个Lexme
  Lexeme result = this.results.pollFirst();
  while(result != null){
    //数量词合并
    this.compound(result);
    if(Dictionary.getSingleton().isStopWord(this.segmentBuff ,  result.getBegin() , result.getLength())){
        //是停止词继续取列表的下一个
      result = this.results.pollFirst(); 				
    }else{
       //不是停止词, 生成lexeme的词元文本,输出
      result.setLexemeText(String.valueOf(segmentBuff , result.getBegin() , result.getLength()));
      break;
    }
  }
  return result;
}

代码示例来源:origin: medcl/elasticsearch-analysis-ik

this.results.pollFirst(); 
this.results.pollFirst();

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

while ((q = initQueries.peekFirst()) != null) {
 q.execute();
 initQueries.pollFirst();

代码示例来源:origin: alibaba/jstorm

public EmitState emit(SpoutOutputCollector collector) {
  if (emittingMessages.isEmpty()) {
    fillMessages();
  }
  int count = 0;
  while (true) {
    MessageAndOffset toEmitMsg = emittingMessages.pollFirst();
    if (toEmitMsg == null) {
      return EmitState.EMIT_END;
    }
    count ++;
    Iterable<List<Object>> tups = generateTuples(toEmitMsg.message());
    if (tups != null) {
      for (List<Object> tuple : tups) {
        LOG.debug("emit message {}", new String(Utils.toByteArray(toEmitMsg.message().payload())));
        collector.emit(tuple, new KafkaMessageId(partition, toEmitMsg.offset()));
      }
      if(count>=config.batchSendCount) {
        break;
      }
    } else {
      ack(toEmitMsg.offset());
    }
  }
  if (emittingMessages.isEmpty()) {
    return EmitState.EMIT_END;
  } else {
    return EmitState.EMIT_MORE;
  }
}

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

GetRequest queueReq = pool.queue.pollFirst();
if (pool.metrics != null) {
 pool.metrics.moveQueuedToRunning();

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

streams.pollFirst();
  streams.pollFirst();
  if (streams.isEmpty()) {
    return false;

代码示例来源:origin: osmandapp/Osmand

public static void main(String[] args) throws IOException {
    OsmandRegions or = new OsmandRegions();
    or.prepareFile("/Users/victorshcherb/osmand/repos/resources/countries-info/regions.ocbf");
    LinkedList<WorldRegion> lst = new LinkedList<WorldRegion>();
    lst.add(or.getWorldRegion());
//        int i =0;
    while (!lst.isEmpty()) {
      WorldRegion wd = lst.pollFirst();
      System.out.println((wd.superregion == null ? "" : wd.superregion.getLocaleName()) + " "
          + wd.getLocaleName() + " " + wd.getRegionDownloadName());
//            if(i++ <=5)
//                lst.addAll(wd.getSubregions());
    }

    or.cacheAllCountries();
//        long t = System.currentTimeMillis();
//        or.cacheAllCountries();
//        System.out.println("Init " + (System.currentTimeMillis() - t));

    //testCountry(or, 15.8, 23.09, "chad");
    testCountry(or, 52.10, 4.92, "the netherlands", "utrecht");
    testCountry(or, 52.15, 7.50, "north rhine-westphalia");
    testCountry(or, 28.8056, 29.9858, "egypt");
//        testCountry(or, 40.0760, 9.2807, "italy", "sardinia");
    testCountry(or, 35.7521, 139.7887, "japan");
    testCountry(or, 46.5145, 102.2580, "mongolia");
    testCountry(or, 62.54, 43.36, "arkhangelsk oblast", "northwestern federal district");
  }

代码示例来源:origin: liuyangming/ByteTCC

CleanupRecord removedRecord = removedList.pollFirst();
if (removedRecord == null) {
  lastEnabledRecord = record;

相关文章