本文整理匯總了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;
}