java.util.ArrayList.addAll()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(294)

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

ArrayList.addAll介绍

[英]Inserts the objects in the specified collection at the specified location in this List. The objects are added in the order they are returned from the collection's iterator.
[中]在此列表中的指定位置插入指定集合中的对象。对象是按照从集合的迭代器返回的顺序添加的。

代码示例

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

private ArrayList<JavaSegment> sortMethodsAndSections (ArrayList<JavaMethod> methods, ArrayList<JniSection> sections) {
  ArrayList<JavaSegment> segments = new ArrayList<JavaSegment>();
  segments.addAll(methods);
  segments.addAll(sections);
  Collections.sort(segments, new Comparator<JavaSegment>() {
    @Override
    public int compare (JavaSegment o1, JavaSegment o2) {
      return o1.getStartIndex() - o2.getStartIndex();
    }
  });
  return segments;
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public boolean addAll(Collection<? extends T> c) {
  boolean b = list.addAll(c);
  lazySet(list.size());
  return b;
}

代码示例来源:origin: hibernate/hibernate-orm

public StandardSQLExceptionConverter(SQLExceptionConversionDelegate... delegates) {
  if ( delegates != null ) {
    this.delegates.addAll( Arrays.asList( delegates ) );
  }
}

代码示例来源:origin: commons-collections/commons-collections

/**
 * Add these Collections to the list of collections in this composite
 *
 * @param comps Collections to be appended to the composite
 */
public void addComposited(Collection[] comps) {
  ArrayList list = new ArrayList(Arrays.asList(this.all));
  list.addAll(Arrays.asList(comps));
  all = (Collection[]) list.toArray(new Collection[list.size()]);
}

代码示例来源:origin: google/j2objc

private List<Class<?>> categories(Description description) {
  ArrayList<Class<?>> categories = new ArrayList<Class<?>>();
  categories.addAll(Arrays.asList(directCategories(description)));
  categories.addAll(Arrays.asList(directCategories(parentDescription(description))));
  return categories;
}

代码示例来源:origin: codecentric/spring-boot-admin

private List<InstanceEvent> appendToEvents(InstanceEvent event, boolean isNewEvent) {
  if (!isNewEvent) {
    return this.unsavedEvents;
  }
  ArrayList<InstanceEvent> events = new ArrayList<>(this.unsavedEvents.size() + 1);
  events.addAll(this.unsavedEvents);
  events.add(event);
  return events;
}

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

process(files, outputRoot, outputRoot, dirToEntries, 0);
ArrayList<Entry> allEntries = new ArrayList();
for (java.util.Map.Entry<File, ArrayList<Entry>> mapEntry : dirToEntries.entrySet()) {
  ArrayList<Entry> dirEntries = mapEntry.getValue();
    newOutputDir = outputRoot;
  else if (!dirEntries.isEmpty()) //
    newOutputDir = dirEntries.get(0).outputDir;
  String outputName = inputDir.getName();
  if (outputSuffix != null) outputName = outputName.replaceAll("(.*)\\..*", "$1") + outputSuffix;
    throw new Exception("Error processing directory: " + entry.inputFile.getAbsolutePath(), ex);
  allEntries.addAll(dirEntries);

代码示例来源:origin: commonsguy/cw-omnibus

public KeyframeSet(Keyframe... keyframes) {
  mNumKeyframes = keyframes.length;
  mKeyframes = new ArrayList<Keyframe>();
  mKeyframes.addAll(Arrays.asList(keyframes));
  mFirstKeyframe = mKeyframes.get(0);
  mLastKeyframe = mKeyframes.get(mNumKeyframes - 1);
  mInterpolator = mLastKeyframe.getInterpolator();
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void attachTo(boolean overrideMainFramebuffer, ViewPort... vps) {
  if (viewPorts.size() > 0) {
    for (ViewPort vp : viewPorts) {
      vp.setOutputFrameBuffer(null);
    }
    viewPorts.get(viewPorts.size() - 1).removeProcessor(this);
  }
  viewPorts.addAll(Arrays.asList(vps));
  viewPorts.get(viewPorts.size() - 1).addProcessor(this);
  this.attachAsMain = overrideMainFramebuffer;
}

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

private void updateList(ArrayList<String> list, String input)
{
  list.clear();
  if (list == rotationWhitelist)
  {
    Matcher m = ROTATION_REGEX.matcher(input);
    while (m.find())
    {
      String rotation = m.group(1).toLowerCase();
      if (!list.contains(rotation))
      {
        list.add(rotation);
      }
    }
  }
  else
  {
    list.addAll(Arrays.asList(input.toLowerCase().split(SPLIT_REGEX)));
  }
}

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

public static <T> Collector<T, ?, Object[][]> toDataProvider()
  {
    return Collector.of(
        ArrayList::new,
        (builder, entry) -> builder.add(new Object[] {entry}),
        (left, right) -> {
          left.addAll(right);
          return left;
        },
        builder -> builder.toArray(new Object[][] {}));
  }
}

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

public ResultRecord(ResultRecord lhs, Tuple rhs, boolean generateOutputFields) {
  if (lhs != null) {
    tupleList.addAll(lhs.tupleList);
  }
  if (rhs != null) {
    tupleList.add(rhs);
  }
  if (generateOutputFields) {
    outFields = doProjection(tupleList, outputFields);
  }
}

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

void addAnnotationsTo(Field<?> target, String enclosingNamespace)
{
  if (target.addAnnotations(annotations, true))
  {
    if (refOffset != references.size())
    {
      int size = references.size();
      while (refOffset < size)
        references.get(refOffset++).enclosingNamespace = enclosingNamespace;
    }
  }
  
  if (!docs.isEmpty())
  {
    target.docs.addAll(docs);
    docs.clear();
  }
}

代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin

@NotNull
 @Override
 public AnAction[] getChildren(@Nullable AnActionEvent e) {
  if (e == null) {
   return AnAction.EMPTY_ARRAY;
  }
  Project project = e.getProject();
  Editor editor = e.getData(CommonDataKeys.EDITOR);
  if (project == null || editor == null) return AnAction.EMPTY_ARRAY;
  PsiFile file = PsiUtilBase.getPsiFileInEditor(editor, project);

  ArrayList<AnAction> children = ContainerUtil.newArrayList();
  for (GoTestFramework framework : GoTestFramework.all()) {
   if (framework.isAvailableOnFile(file)) {
    children.addAll(framework.getGenerateMethodActions());
   }
  }
  return !children.isEmpty() ? children.toArray(new AnAction[children.size()]) : AnAction.EMPTY_ARRAY;
 }
}

代码示例来源:origin: commons-collections/commons-collections

/**
 * Removes a collection from the those being decorated in this composite.
 *
 * @param coll  collection to be removed
 */
public void removeComposited(Collection coll) {
  ArrayList list = new ArrayList(this.all.length);
  list.addAll(Arrays.asList(this.all));
  list.remove(coll);
  this.all = (Collection[]) list.toArray(new Collection[list.size()]);
}

代码示例来源:origin: commons-collections/commons-collections

public Collection makeConfirmedFullCollection() {
  ArrayList list = new ArrayList();
  list.addAll(Arrays.asList(getFullElements()));
  return list;
}

代码示例来源:origin: Tencent/tinker

private void getCompressMethodFromApk() {
  ZipFile zipFile = null;
  try {
    zipFile = new ZipFile(config.mNewApkFile);
    ArrayList<String> sets = new ArrayList<>();
    sets.addAll(modifiedSet);
    sets.addAll(addedSet);
    ZipEntry zipEntry;
    for (String name : sets) {
      zipEntry = zipFile.getEntry(name);
      if (zipEntry != null && zipEntry.getMethod() == ZipEntry.STORED) {
        storedSet.add(name);
      }
    }
  } catch (Throwable throwable) {
  } finally {
    if (zipFile != null) {
      try {
        zipFile.close();
      } catch (IOException e) {
      }
    }
  }
}

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

private ArrayList<JavaSegment> sortMethodsAndSections (ArrayList<JavaMethod> methods, ArrayList<JniSection> sections) {
  ArrayList<JavaSegment> segments = new ArrayList<JavaSegment>();
  segments.addAll(methods);
  segments.addAll(sections);
  Collections.sort(segments, new Comparator<JavaSegment>() {
    @Override
    public int compare (JavaSegment o1, JavaSegment o2) {
      return o1.getStartIndex() - o2.getStartIndex();
    }
  });
  return segments;
}

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

process(files, outputRoot, outputRoot, dirToEntries, 0);
ArrayList<Entry> allEntries = new ArrayList();
for (java.util.Map.Entry<File, ArrayList<Entry>> mapEntry : dirToEntries.entrySet()) {
  ArrayList<Entry> dirEntries = mapEntry.getValue();
    newOutputDir = outputRoot;
  else if (!dirEntries.isEmpty()) //
    newOutputDir = dirEntries.get(0).outputDir;
  String outputName = inputDir.getName();
  if (outputSuffix != null) outputName = outputName.replaceAll("(.*)\\..*", "$1") + outputSuffix;
    throw new Exception("Error processing directory: " + entry.inputFile.getAbsolutePath(), ex);
  allEntries.addAll(dirEntries);

代码示例来源:origin: hibernate/hibernate-orm

@Override
public MetadataBuilder applySourceProcessOrdering(MetadataSourceType... sourceTypes) {
  options.sourceProcessOrdering.addAll( Arrays.asList( sourceTypes ) );
  return this;
}

相关文章

微信公众号

最新文章

更多