本文整理了Java中java.util.LinkedList.addAll()
方法的一些代码示例,展示了LinkedList.addAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedList.addAll()
方法的具体详情如下:
包路径:java.util.LinkedList
类名称:LinkedList
方法名:addAll
[英]Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator.
[中]从指定位置开始,将指定集合中的所有元素插入此列表。将当前位于该位置的元素(如果有)和任何后续元素向右移动(增加其索引)。新元素将按指定集合的迭代器返回的顺序出现在列表中。
代码示例来源:origin: oblac/jodd
/**
* Appends other buffer to this one.
*/
public Buffer append(final Buffer buffer) {
if (buffer.list.isEmpty()) {
// nothing to append
return buffer;
}
list.addAll(buffer.list);
last = buffer.last;
size += buffer.size;
return this;
}
代码示例来源:origin: fesh0r/fernflower
private static boolean insertNestedClass(ClassNode root, ClassNode child) {
Set<String> setEnclosing = child.enclosingClasses;
LinkedList<ClassNode> stack = new LinkedList<>();
stack.add(root);
while (!stack.isEmpty()) {
ClassNode node = stack.removeFirst();
if (setEnclosing.contains(node.classStruct.qualifiedName)) {
node.nested.add(child);
child.parent = node;
return true;
}
// note: ordered list
stack.addAll(node.nested);
}
return false;
}
代码示例来源:origin: neo4j/neo4j
private Iterator<TraversalBranch> gatherSourceIterator( TraversalContext metadata )
{
LinkedList<TraversalBranch> queue = new LinkedList<>();
queue.add( current.next( expander, metadata ) );
while ( true )
{
List<TraversalBranch> level = gatherOneLevel( queue, metadata );
if ( level.isEmpty() )
{
break;
}
queue.addAll( 0, level );
}
return queue.iterator();
}
代码示例来源:origin: org.assertj/assertj-core
int hash = 0;
while (!stack.isEmpty()) {
obj = stack.removeFirst();
if (obj == null || visited.contains(obj)) {
stack.addAll(0, (Collection<?>) obj);
continue;
stack.addAll(0, ((Map<?, ?>) obj).keySet());
stack.addAll(0, ((Map<?, ?>) obj).values());
continue;
stack.add(Math.round(((Number) obj).doubleValue()));
continue;
代码示例来源:origin: apache/hbase
daughterRegions.put(rsLocation, entry);
daughterRegions.get(rsLocation).add(dr);
while (!regionList.isEmpty()) {
dr = regionList.pop();
daughterRegions.put(newRs, entry);
daughterRegions.get(newRs).add(dr);
dr = null;
continue;
if (regionList.isEmpty()) {
daughterRegions.remove(rsLoc);
LOG.debug("Wait for outstanding splits " + outstanding.size());
local_finished = splitScan(outstanding, connection, tableName, splitAlgo);
if (local_finished.isEmpty()) {
Thread.sleep(30 * 1000);
} else {
finished.addAll(local_finished);
outstanding.removeAll(local_finished);
LOG.debug(local_finished.size() + " outstanding splits finished");
finished.add(dr);
代码示例来源:origin: stanfordnlp/CoreNLP
(tokI.tag().startsWith("D") && suffix != null) ||
(tokI.tag().startsWith("R") && suffix != null))) {
body.add(i, be.get(0));
i += 1;
if (suffix != null) {
i += 1;
body.add(i, suffix.get(0));
addedSuffix = true;
body.add(prepNum.get(0));
body.add(WORD_IN);
body.add(prepNum.get(1));
body.addAll(suffix);
body.add(1, be.get(0));
} else {
body.addAll(be);
obj.set(UnknownTokenMarker.class, true);
body.addAll(objType);
代码示例来源:origin: oracle/opengrok
while (!stack.isEmpty()) {
Group g = stack.getFirst();
stack.removeFirst();
stack.addAll(0, g.getSubgroups());
代码示例来源:origin: stanfordnlp/CoreNLP
relationTokens.add(relNode);
for (int i = prepChunk.size() - 1; i >=0; --i) { relationTokens.addFirst(prepChunk.get(i)); }
} else {
relationTokens.addAll(prepChunk);
for (int i = prepChunk.size() - 1; i >=0; --i) { relationTokens.addFirst(prepChunk.get(i)); }
} else {
relationTokens.addAll(prepChunk);
代码示例来源:origin: prestodb/presto
populateFromDbHelper(recordMap, rootGroupIds, resourceGroupIdTemplateMap, subGroupIdsToBuild);
for (LinkedList<Long> queue = new LinkedList<>(rootGroupIds); !queue.isEmpty(); ) {
Long id = queue.pollFirst();
resourceGroupIdTemplateMap.computeIfAbsent(id, k -> {
queue.addAll(0, childrenToBuild);
代码示例来源:origin: fesh0r/fernflower
public static void clearStatements(RootStatement root) {
LinkedList<Statement> stack = new LinkedList<>();
stack.add(root);
while (!stack.isEmpty()) {
Statement stat = stack.removeFirst();
stat.clearTempInformation();
stack.addAll(stat.getStats());
}
}
}
代码示例来源:origin: quartz-scheduler/quartz
public void addJobListener(JobListener jobListener, List<Matcher<JobKey>> matchers) {
if (jobListener.getName() == null || jobListener.getName().length() == 0) {
throw new IllegalArgumentException(
"JobListener name cannot be empty.");
}
synchronized (globalJobListeners) {
globalJobListeners.put(jobListener.getName(), jobListener);
LinkedList<Matcher<JobKey>> matchersL = new LinkedList<Matcher<JobKey>>();
if(matchers != null && matchers.size() > 0)
matchersL.addAll(matchers);
else
matchersL.add(EverythingMatcher.allJobs());
globalJobListenersMatchers.put(jobListener.getName(), matchersL);
}
}
代码示例来源:origin: joel-costigliola/assertj-core
int hash = 0;
while (!stack.isEmpty()) {
obj = stack.removeFirst();
if (obj == null || visited.contains(obj)) {
stack.addAll(0, (Collection<?>) obj);
continue;
stack.addAll(0, ((Map<?, ?>) obj).keySet());
stack.addAll(0, ((Map<?, ?>) obj).values());
continue;
stack.add(Math.round(((Number) obj).doubleValue()));
continue;
代码示例来源:origin: apache/hive
private void drainNewRequestList() {
synchronized (newRequestList) {
if (!newRequestList.isEmpty()) {
pendingRequests.addAll(newRequestList);
newRequestList.clear();
}
}
}
代码示例来源:origin: spotbugs/spotbugs
workList.addAll(appClassList);
while (!workList.isEmpty()) {
if (Thread.interrupted()) {
throw new InterruptedException();
代码示例来源:origin: jersey/jersey
private Iterator<Class<?>> getClassHierarchyIterator(final Class<?> classParam) {
if (classParam == null) {
return Collections.<Class<?>>emptyList().iterator();
}
final ArrayList<Class<?>> classes = new ArrayList<>();
final LinkedList<Class<?>> unprocessed = new LinkedList<>();
// Object is special - needs to be always the furthest type.
boolean objectFound = false;
unprocessed.add(classParam);
while (!unprocessed.isEmpty()) {
final Class<?> clazz = unprocessed.removeFirst();
if (Object.class.equals(clazz)) {
objectFound = true;
} else {
classes.add(clazz);
}
unprocessed.addAll(Arrays.asList(clazz.getInterfaces()));
final Class<?> superclazz = clazz.getSuperclass();
if (superclazz != null) {
unprocessed.add(superclazz);
}
}
if (objectFound) {
classes.add(Object.class);
}
return classes.iterator();
}
}
代码示例来源:origin: quartz-scheduler/quartz
public void addTriggerListener(TriggerListener triggerListener, List<Matcher<TriggerKey>> matchers) {
if (triggerListener.getName() == null
|| triggerListener.getName().length() == 0) {
throw new IllegalArgumentException(
"TriggerListener name cannot be empty.");
}
synchronized (globalTriggerListeners) {
globalTriggerListeners.put(triggerListener.getName(), triggerListener);
LinkedList<Matcher<TriggerKey>> matchersL = new LinkedList<Matcher<TriggerKey>>();
if(matchers != null && matchers.size() > 0)
matchersL.addAll(matchers);
else
matchersL.add(EverythingMatcher.allTriggers());
globalTriggerListenersMatchers.put(triggerListener.getName(), matchersL);
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
while (!preTerms.isEmpty() && isPunc(preTerms.getFirst())) {
newChildren.add(preTerms.getFirst());
preTerms.removeFirst();
LinkedList<Tree> temp = new LinkedList<>();
if (newChild.children().length > 0) {
newChildren.add(newChild);
while (!preTerms.isEmpty() && isPunc(preTerms.getLast())) {
temp.addFirst(preTerms.getLast());
preTerms.removeLast();
newChildren.addAll(temp);
while (!newChildren.isEmpty() && isPunc(newChildren.getFirst())) {
newChildren.removeFirst();
代码示例来源:origin: org.codehaus.groovy/groovy
private void recordPhaseOpsInAllOtherPhases(int currPhase) {
// apart from current phase, push new operations for every other phase in the master phase ops list
for (int ph = Phases.INITIALIZATION; ph <= Phases.ALL; ph++) {
if (ph != currPhase && !newPhaseOperations[ph].isEmpty()) {
phaseOperations[ph].addAll(newPhaseOperations[ph]);
newPhaseOperations[ph].clear();
}
}
}
代码示例来源:origin: EngineHub/WorldEdit
LinkedList<UnaryOperator> postfixes = new LinkedList<>();
do {
if (input.isEmpty()) {
throw new ParserException(-1, "Expression missing.");
input.addAll(postfixes);
while (!input.isEmpty()) {
final Identifiable last = input.removeLast();
final int lastPosition = last.getPosition();
代码示例来源:origin: jersey/jersey
private Iterator<Class<?>> getClassHierarchyIterator(final Class<?> classParam) {
if (classParam == null) {
return Collections.<Class<?>>emptyList().iterator();
}
final ArrayList<Class<?>> classes = new ArrayList<>();
final LinkedList<Class<?>> unprocessed = new LinkedList<>();
// Object is special - needs to be always the furthest type.
boolean objectFound = false;
unprocessed.add(classParam);
while (!unprocessed.isEmpty()) {
final Class<?> clazz = unprocessed.removeFirst();
if (Object.class.equals(clazz)) {
objectFound = true;
} else {
classes.add(clazz);
}
unprocessed.addAll(Arrays.asList(clazz.getInterfaces()));
final Class<?> superclazz = clazz.getSuperclass();
if (superclazz != null) {
unprocessed.add(superclazz);
}
}
if (objectFound) {
classes.add(Object.class);
}
return classes.iterator();
}
}
内容来源于网络,如有侵权,请联系作者删除!