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

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

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

LinkedList.offerLast介绍

[英]Inserts the specified element at the end of this list.
[中]在此列表末尾插入指定的元素。

代码示例

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

  1. splits.offerLast(split);

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

  1. /**
  2. * Adds a single input split
  3. *
  4. * @param split The input split to add
  5. */
  6. public void addInputSplit(LocatableInputSplitWithCount split) {
  7. int localCount = split.getLocalCount();
  8. if (minLocalCount == -1) {
  9. // first split to add
  10. this.minLocalCount = localCount;
  11. this.elementCycleCount = 1;
  12. this.splits.offerFirst(split);
  13. } else if (localCount < minLocalCount) {
  14. // split with new min local count
  15. this.nextMinLocalCount = this.minLocalCount;
  16. this.minLocalCount = localCount;
  17. // all other splits have more local host than this one
  18. this.elementCycleCount = 1;
  19. splits.offerFirst(split);
  20. } else if (localCount == minLocalCount ) {
  21. this.elementCycleCount++;
  22. this.splits.offerFirst(split);
  23. } else {
  24. if (localCount < nextMinLocalCount) {
  25. nextMinLocalCount = localCount;
  26. }
  27. splits.offerLast(split);
  28. }
  29. }

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

  1. @Override
  2. public boolean offer(E e) {
  3. if (size() >= _capacity) {
  4. _linkedList.removeFirst();
  5. }
  6. _linkedList.offerLast(e);
  7. return true;
  8. }

代码示例来源:origin: com.jtransc/jtransc-rt

  1. @Override
  2. public boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException {
  3. return queue.offerLast(e);
  4. }

代码示例来源:origin: com.jtransc/jtransc-rt

  1. @Override
  2. public boolean offerLast(E e) {
  3. return queue.offerLast(e);
  4. }

代码示例来源:origin: com.google.jsilver/jsilver

  1. private void initStackAndSet() {
  2. objectStack = new LinkedList<T>();
  3. objectsSet = new HashSet<T>();
  4. objectStack.offerLast(firstObject);
  5. objectsSet.add(firstObject);
  6. // there is no need for using firstObject pointer anymore
  7. firstObject = null;
  8. }

代码示例来源:origin: com.virjar/dungproxy-client

  1. @Override
  2. public boolean offerLast(T t) {
  3. lock.lock();
  4. try {
  5. boolean ret = super.offerLast(t);
  6. notifyIfNotEmpty();
  7. return ret;
  8. } finally {
  9. lock.unlock();
  10. }
  11. }

代码示例来源:origin: org.apache.openejb.patch/openjpa-kernel

  1. @Override
  2. public boolean offerLast(Object paramObject) {
  3. if (_directAccess) {
  4. return super.offerLast(paramObject);
  5. }
  6. if (isDelayLoad()) {
  7. load();
  8. }
  9. return super.offerLast(paramObject);
  10. }

代码示例来源:origin: org.apache.openjpa/openjpa-all

  1. @Override
  2. public boolean offerLast(Object paramObject) {
  3. if (_directAccess) {
  4. return super.offerLast(paramObject);
  5. }
  6. if (isDelayLoad()) {
  7. load();
  8. }
  9. return super.offerLast(paramObject);
  10. }

代码示例来源:origin: org.apache.openjpa/openjpa-kernel

  1. @Override
  2. public boolean offerLast(Object paramObject) {
  3. if (_directAccess) {
  4. return super.offerLast(paramObject);
  5. }
  6. if (isDelayLoad()) {
  7. load();
  8. }
  9. return super.offerLast(paramObject);
  10. }

代码示例来源:origin: uk.org.retep.tools/collections

  1. @Override
  2. public boolean offerLast( E e )
  3. {
  4. if( size() >= maxElements )
  5. {
  6. return false;
  7. }
  8. return super.offerLast( e );
  9. }

代码示例来源:origin: org.onehippo.cms7/hippo-cms7-utilities

  1. @Override
  2. public boolean offerLast(E element) {
  3. validateCapacityAndPollFirstIfNeeded();
  4. return super.offerLast(element);
  5. }

代码示例来源:origin: org.apache.openejb.patch/openjpa

  1. @Override
  2. public boolean offerLast(Object paramObject) {
  3. if (_directAccess) {
  4. return super.offerLast(paramObject);
  5. }
  6. if (isDelayLoad()) {
  7. load();
  8. }
  9. return super.offerLast(paramObject);
  10. }

代码示例来源:origin: stackoverflow.com

  1. public class RingGroupPrint {
  2. public static void printSquare(int min,int max){
  3. LinkedList<Integer> list = new LinkedList<Integer>();
  4. for (int a=min; a<=max; a++) {
  5. list.add(a);
  6. }
  7. for (int i= 0, amount = max-min +1; i<amount; i++ ){
  8. for (Integer val: list) {
  9. System.out.print(val);
  10. }
  11. list.offerLast(list.pollFirst());
  12. System.out.println();
  13. }
  14. }
  15. public static void main(String[] args) {
  16. printSquare(1, 5);
  17. }
  18. }

代码示例来源:origin: net.digitalid.utility/utility-collections

  1. @Impure
  2. @Override
  3. @NonFrozenRecipient
  4. public boolean offerLast(@Captured E element) {
  5. return super.offerLast(element);
  6. }

代码示例来源:origin: root-wyj/springboot_im

  1. @Override
  2. public void addCost(long userId, int cost) {
  3. if (userId == context.joinedUserId.peek()) {
  4. if (cost < context.preRoundCost) {
  5. RoomContext.logger.info("{}(id:{})想加注{}。 但是小于之前{}的注码,失败!", context.usersInRoom.get(userId).getUser().getUsername(), userId, cost, context.preRoundCost);
  6. return;
  7. }
  8. context.usersInRoom.get(userId).addThisGameCost(cost);
  9. RoomContext.logger.info("{}(id:{})加注{}。",context.usersInRoom.get(userId).getUser().getUsername(), userId, cost);
  10. context.gameCosted += cost;
  11. context.preRoundCost = cost;
  12. Long pollId = context.joinedUserId.pollFirst();
  13. context.joinedUserId.offerLast(pollId);
  14. } else {
  15. RoomContext.logger.info("{}(id:{})想加注{}, 但是还没轮到他说话。",context.usersInRoom.get(userId).getUser().getUsername(), userId, cost);
  16. }
  17. }

代码示例来源:origin: jsettlers/settlers-remake

  1. private void handleBricklayerRequest() {
  2. BricklayerRequest bricklayerRequest = bricklayerRequests.poll();
  3. if (bricklayerRequest != null && bricklayerRequest.isRequestAlive()) {
  4. IManageableBricklayer bricklayer = joblessBricklayers.removeObjectNextTo(bricklayerRequest.getPosition());
  5. if (bricklayer != null) {
  6. if (!bricklayer.setBricklayerJob(bricklayerRequest.building, bricklayerRequest.bricklayerTargetPos, bricklayerRequest.direction)) {
  7. bricklayerRequests.add(bricklayerRequest);
  8. }
  9. } else if (!bricklayerRequest.isCreationRequested()) { // if the creation hasn't been requested yet => request it.
  10. createNewToolUser(bricklayerRequest);
  11. bricklayerRequest.setCreationRequested();
  12. bricklayerRequests.offerLast(bricklayerRequest);
  13. } else { // no bricklayer available and creation already requested => nothing to do.
  14. bricklayerRequests.offerLast(bricklayerRequest);
  15. }
  16. }
  17. }

代码示例来源:origin: jsettlers/settlers-remake

  1. private void handleWorkerRequest() {
  2. WorkerRequest workerRequest = workerRequests.poll();
  3. if (workerRequest != null) {
  4. IManageableWorker worker = joblessWorkers.removeObjectNextTo(workerRequest.getPosition(), currentWorker -> currentWorker.getMovableType() == workerRequest.movableType);
  5. if (worker != null && worker.isAlive()) {
  6. worker.setWorkerJob(workerRequest.building);
  7. } else {
  8. if (!workerRequest.creationRequested) {
  9. workerRequest.creationRequested = true;
  10. createNewToolUser(workerRequest);
  11. }
  12. workerRequests.offerLast(workerRequest);
  13. }
  14. }
  15. }

代码示例来源:origin: org.nuiton.wikitty/wikitty-api

  1. @Override
  2. public boolean visitEnter(TreeNodeResult<String> node) {
  3. String id = node.getObject();
  4. int count = node.getAttCount();
  5. TARGET object = converter.convert(id);
  6. TreeNodeResult<TARGET> newNode = new TreeNodeResult<TARGET>(
  7. object, count);
  8. TreeNodeResult<TARGET> parent = stack.peekLast();
  9. if (parent == null) {
  10. // le premier noeud, donc le root a retourner plus tard
  11. tree = newNode;
  12. } else {
  13. parent.add(newNode);
  14. }
  15. stack.offerLast(newNode);
  16. return true;
  17. }

代码示例来源:origin: org.nuiton.wikitty/wikitty-api

  1. @Override
  2. public boolean visitEnter(WikittyQueryResultTreeNode<String> node) {
  3. String id = node.getObject();
  4. int count = node.getAttCount();
  5. TARGET object = converter.convert(id);
  6. WikittyQueryResultTreeNode<TARGET> newNode = new WikittyQueryResultTreeNode<TARGET>(
  7. object, count);
  8. WikittyQueryResultTreeNode<TARGET> parent = stack.peekLast();
  9. if (parent == null) {
  10. // le premier noeud, donc le root a retourner plus tard
  11. tree = newNode;
  12. } else {
  13. parent.add(newNode);
  14. }
  15. stack.offerLast(newNode);
  16. return true;
  17. }

相关文章