本文整理汇总了Java中java.util.List.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java List.addAll方法的具体用法?Java List.addAll怎么用?Java List.addAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.List
的用法示例。
在下文中一共展示了List.addAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: joinFiles
import java.util.List; //导入方法依赖的package包/类
private Iterable<? extends JavaFileObject> joinFiles(
List<String> files, List<JavaFileObject> fileObjects) {
if (files == null)
return fileObjects;
if (internalFileManager == null)
internalFileManager = compiler.getStandardFileManager(null, null, null);
Iterable<? extends JavaFileObject> filesAsFileObjects =
internalFileManager.getJavaFileObjectsFromStrings(files);
if (fileObjects == null)
return filesAsFileObjects;
List<JavaFileObject> combinedList = new ArrayList<>();
for (JavaFileObject o : filesAsFileObjects)
combinedList.add(o);
combinedList.addAll(fileObjects);
return combinedList;
}
示例2: formatUserEnName
import java.util.List; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
private List<String> formatUserEnName(SearchResult sResult) {
if (null == sResult) {
return Collections.emptyList();
}
List<String> result = new ArrayList<String>();
try {
String memberKey = ldapConfig.get("memberKey");
NamingEnumeration namingEnumeration = sResult.getAttributes().getAll();
while (namingEnumeration.hasMoreElements()) {
Attribute attr = (Attribute) namingEnumeration.next();
String attrId = attr.getID();
if (memberKey.equals(attrId)) {
List<String> userEnNames = formatUserEnName(attr);
result.addAll(userEnNames);
}
}
}
catch (Exception e) {
loggerError("formatUserEnName 619", "", e);
}
return result;
}
示例3: getSimpleWordList
import java.util.List; //导入方法依赖的package包/类
public List<Word> getSimpleWordList()
{
List<IWord> wordList = getWordList();
List<Word> simpleWordList = new LinkedList<Word>();
for (IWord word : wordList)
{
if (word instanceof CompoundWord)
{
simpleWordList.addAll(((CompoundWord) word).innerList);
}
else
{
simpleWordList.add((Word) word);
}
}
return simpleWordList;
}
示例4: main
import java.util.List; //导入方法依赖的package包/类
public static void main (String... args) throws Exception {
LingeredApp app = null;
if (!Platform.shouldSAAttach()) {
System.out.println(
"SA attach not expected to work - test skipped.");
return;
}
try {
List<String> vmArgs = new ArrayList<String>();
vmArgs.add("-XX:+ProfileInterpreter");
vmArgs.addAll(Utils.getVmOptions());
app = LingeredApp.startApp(vmArgs);
System.out.println ("Started LingeredApp with pid " + app.getPid());
startClhsdbForPrintMdo(app.getPid());
verifyPrintMdoOutput();
} finally {
LingeredApp.stopApp(app);
}
}
示例5: bitpos
import java.util.List; //导入方法依赖的package包/类
public void bitpos(final byte[] key, final boolean value, final BitPosParams params) {
final List<byte[]> args = new ArrayList<byte[]>();
args.add(key);
args.add(toByteArray(value));
args.addAll(params.getParams());
sendCommand(BITPOS, args.toArray(new byte[args.size()][]));
}
示例6: Sorted
import java.util.List; //导入方法依赖的package包/类
/**
* Ctor.
* @param src The underlying collection
* @param cmp The comparator
*/
public Sorted(final Comparator<T> cmp, final Collection<T> src) {
super(() -> {
final List<T> items = new ArrayList<>(src.size());
items.addAll(src);
items.sort(cmp);
return Collections.unmodifiableList(items);
}
);
}
示例7: computeTestMethods
import java.util.List; //导入方法依赖的package包/类
@Override
protected List<FrameworkMethod> computeTestMethods() {
final List<FrameworkMethod> testMethods = new ArrayList<>();
final Spockito.Unroll unroll = testMethod.getAnnotation(Spockito.Unroll.class);
if (unroll == null) {
testMethods.add(testMethod);
} else {
final Table table = Table.parse(unroll.value());
testMethods.addAll(unroll(table));
}
return testMethods;
}
示例8: getDefaultClasspathEntries
import java.util.List; //导入方法依赖的package包/类
@Override
public IClasspathEntry[] getDefaultClasspathEntries()
{
List<IClasspathEntry> entries = new ArrayList<>();
entries.addAll(Arrays.asList(PreferenceConstants.getDefaultJRELibrary()));
entries.add(JavaCore.newContainerEntry(JPFClasspathPlugin.CONTAINER_PATH));
return entries.toArray(new IClasspathEntry[entries.size()]);
}
示例9: ClassSizeInfo
import java.util.List; //导入方法依赖的package包/类
public ClassSizeInfo(final Class<?> clazz) {
long newFieldsSize = 0;
final List<Field> newReferenceFields = new LinkedList<>();
for (final Field f : clazz.getDeclaredFields()) {
if (Modifier.isStatic(f.getModifiers())) {
continue;
}
final Class<?> type = f.getType();
if (type.isPrimitive()) {
newFieldsSize += getPrimitiveFieldSize(type);
} else {
f.setAccessible(true);
newReferenceFields.add(f);
newFieldsSize += referenceSize;
}
}
final Class<?> superClass = clazz.getSuperclass();
if (superClass != null) {
final ClassSizeInfo superClassInfo = getClassSizeInfo(superClass);
newFieldsSize += roundTo(superClassInfo.fieldsSize, superclassFieldPadding);
newReferenceFields.addAll(Arrays.asList(superClassInfo.referenceFields));
}
this.fieldsSize = newFieldsSize;
this.objectSize = roundTo(objectHeaderSize + newFieldsSize, objectPadding);
this.referenceFields = newReferenceFields.toArray(
new Field[0]);
}
示例10: getMapObjectLayers
import java.util.List; //导入方法依赖的package包/类
@Override
public List<IMapObjectLayer> getMapObjectLayers() {
final List<IMapObjectLayer> shapeLayers = new CopyOnWriteArrayList<>();
if (this.getObjectgroups() != null) {
shapeLayers.addAll(this.getObjectgroups());
}
return shapeLayers;
}
示例11: listAllDirsDislikeNamesNoCase
import java.util.List; //导入方法依赖的package包/类
/**
* 列出file目录下所有不包含names列表中任意名称的目录,忽略大小写,包括子目录
*
* @param list 文件列表,传出参数
* @param names 名称列表
* @param file 文件
*/
public static void listAllDirsDislikeNamesNoCase(List<File> list, File file, String[] names)
{
File[] files = listDirsDislikeNamesNoCase(file, names);
list.addAll(Arrays.asList(files));
files = listDirs(file);
for(File f : files)
{
listAllDirsDislikeNamesNoCase(list, f, names);
}
}
示例12: isValid
import java.util.List; //导入方法依赖的package包/类
@Override
public boolean isValid(ILaunchConfiguration config) {
// Validate each addon
try {
List<IEngineAddon> addons = new ArrayList<IEngineAddon>();
for (Entry<EngineAddonSpecificationExtension, Button> entry : _components.entrySet()) {
if (entry.getValue().getSelection()) {
addons.add(entry.getKey().instanciateComponent());
}
}
List<String> errors = new ArrayList<String>();
for (IEngineAddon iEngineAddon : addons) {
errors.addAll(iEngineAddon.validate(addons));
}
if (!errors.isEmpty()) {
for (String msg : errors) {
setErrorMessage(msg);
}
return false;
}
} catch (Exception e) {
e.printStackTrace();
}
setErrorMessage(null);
return true;
}
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:28,代码来源:LaunchConfigurationDataProcessingTab.java
示例13: getSyncedFields
import java.util.List; //导入方法依赖的package包/类
public static List<SyncedField> getSyncedFields(Object te, Class searchedAnnotation) {
List<SyncedField> syncedFields = new ArrayList<SyncedField>();
Class examinedClass = te.getClass();
while (examinedClass != null) {
for (Field field : examinedClass.getDeclaredFields()) {
if (field.getAnnotation(searchedAnnotation) != null) {
syncedFields.addAll(getSyncedFieldsForField(field, te, searchedAnnotation));
}
}
examinedClass = examinedClass.getSuperclass();
}
return syncedFields;
}
示例14: configMutliCluster
import java.util.List; //导入方法依赖的package包/类
public void configMutliCluster(ZooKeeper zk) {
if (_servers.size() == 1) {
return;
}
String cluster1 = _servers.get(0);
try {
if (_servers.size() > 1) {
// 强制的声明accessible
ReflectionUtils.makeAccessible(clientCnxnField);
ReflectionUtils.makeAccessible(hostProviderField);
ReflectionUtils.makeAccessible(serverAddressesField);
// 添加第二组集群列表
for (int i = 1; i < _servers.size(); i++) {
String cluster = _servers.get(i);
// 强制获取zk中的地址信息
ClientCnxn cnxn = (ClientCnxn) ReflectionUtils.getField(clientCnxnField, zk);
HostProvider hostProvider = (HostProvider) ReflectionUtils.getField(hostProviderField, cnxn);
List<InetSocketAddress> serverAddrs = (List<InetSocketAddress>) ReflectionUtils.getField(serverAddressesField,
hostProvider);
// 添加第二组集群列表
serverAddrs.addAll(new ConnectStringParser(cluster).getServerAddresses());
}
}
} catch (Exception e) {
try {
if (zk != null) {
zk.close();
}
} catch (InterruptedException ie) {
// ignore interrupt
}
throw new ZkException("zookeeper_create_error, serveraddrs=" + cluster1, e);
}
}
示例15: getAllChildren
import java.util.List; //导入方法依赖的package包/类
public List<QubbleCuboid> getAllChildren()
{
List<QubbleCuboid> children = new ArrayList<>();
for (QubbleCuboid cuboid : this.children)
{
children.add(cuboid);
children.addAll(cuboid.getAllChildren());
}
return children;
}