Java Code Examples for java.util.List.addAll()

The following are Jave code examples for showing how to use addAll() of the java.util.List class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: openjdk-jdk10   File: JavacTask.java   View Source Code Vote up 6 votes
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;
}
 
Example 2
Project: uavstack   File: GUISSOLdapClient.java   View Source Code Vote up 6 votes
@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;
}
 
Example 3
Project: hanlpStudy   File: Document.java   View Source Code Vote up 6 votes
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;
}
 
Example 4
Project: openjdk-jdk10   File: TestPrintMdo.java   View Source Code Vote up 6 votes
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);
        }
    }
 
Example 5
Project: JRediClients   File: BinaryClient.java   View Source Code Vote up 5 votes
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()][]));
}
 
Example 6
Project: cactoos   File: Sorted.java   View Source Code Vote up 5 votes
/**
     * 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);
        }
);
    }
 
Example 7
Project: spockito   File: SingleTestMultiRowRunner.java   View Source Code Vote up 5 votes
@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;
}
 
Example 8
Project: Equella   File: NewJPFPluginWizardPageOne.java   View Source Code Vote up 5 votes
@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()]);
}
 
Example 9
Project: openjdk-jdk10   File: ObjectSizeCalculator.java   View Source Code Vote up 5 votes
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]);
}
 
Example 10
Project: litiengine   File: Map.java   View Source Code Vote up 5 votes
@Override
public List<IMapObjectLayer> getMapObjectLayers() {
  final List<IMapObjectLayer> shapeLayers = new CopyOnWriteArrayList<>();
  if (this.getObjectgroups() != null) {
    shapeLayers.addAll(this.getObjectgroups());
  }
  return shapeLayers;
}
 
Example 11
Project: EasyAndroid   File: FileTool.java   View Source Code Vote up 5 votes
/**
 * 列出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);
    }
}
 
Example 12
Project: gemoc-studio-modeldebugging   File: LaunchConfigurationDataProcessingTab.java   View Source Code Vote up 5 votes
@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;
}
 
Example 13
Project: pnc-repressurized   File: NetworkUtils.java   View Source Code Vote up 5 votes
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;
}
 
Example 14
Project: otter-G   File: ZooKeeperx.java   View Source Code Vote up 5 votes
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);
    }

}
 
Example 15
Project: ObsidianSuite   File: QubbleCuboid.java   View Source Code Vote up 5 votes
public List<QubbleCuboid> getAllChildren()
{
	List<QubbleCuboid> children = new ArrayList<>();

	for (QubbleCuboid cuboid : this.children)
	{
		children.add(cuboid);
		children.addAll(cuboid.getAllChildren());
	}

	return children;
}
 
Example 16
Project: NetDiscovery   File: OrSelector.java   View Source Code Vote up 5 votes
@Override
public List<String> selectList(String text) {
    List<String> results = new ArrayList<String>();
    for (Selector selector : selectors) {
        List<String> strings = selector.selectList(text);
        results.addAll(strings);
    }
    return results;
}
 
Example 17
Project: Cognizant-Intelligent-Test-Scripter   File: Project.java   View Source Code Vote up 5 votes
public List<TestCase> getImpactedTestDataTestCases(String testDataName) {
    List<TestCase> impactedTestCases = new ArrayList<>();
    for (Scenario scenario : scenarios) {
        impactedTestCases.addAll(scenario.getImpactedTestDataTestCases(testDataName));
    }
    return impactedTestCases;
}
 
Example 18
Project: JRediClients   File: RedissonHyperLogLog.java   View Source Code Vote up 5 votes
@Override
public RFuture<Long> countWithAsync(String... otherLogNames) {
    List<Object> args = new ArrayList<Object>(otherLogNames.length + 1);
    args.add(getName());
    args.addAll(Arrays.asList(otherLogNames));
    return commandExecutor.writeAsync(getName(), codec, RedisCommands.PFCOUNT, args.toArray());
}
 
Example 19
Project: elasticsearch_my   File: InjectorShell.java   View Source Code Vote up 4 votes
/**
 * Creates and returns the injector shells for the current modules. Multiple shells will be
 * returned if any modules contain {@link Binder#newPrivateBinder private environments}. The
 * primary injector will be first in the returned list.
 */
List<InjectorShell> build(Initializer initializer, BindingProcessor bindingProcessor,
                          Stopwatch stopwatch, Errors errors) {
    if (stage == null) {
        throw new IllegalStateException("Stage not initialized");
    }
    if (privateElements != null && parent == null) {
        throw new IllegalStateException("PrivateElements with no parent");
    }
    if (state == null) {
        throw new IllegalStateException("no state. Did you remember to lock() ?");
    }

    InjectorImpl injector = new InjectorImpl(state, initializer);
    if (privateElements != null) {
        privateElements.initInjector(injector);
    }

    // bind Stage and Singleton if this is a top-level injector
    if (parent == null) {
        modules.add(0, new RootModule(stage));
        new TypeConverterBindingProcessor(errors).prepareBuiltInConverters(injector);
    }

    elements.addAll(Elements.getElements(stage, modules));
    stopwatch.resetAndLog("Module execution");

    new MessageProcessor(errors).process(injector, elements);

    new TypeListenerBindingProcessor(errors).process(injector, elements);
    List<TypeListenerBinding> listenerBindings = injector.state.getTypeListenerBindings();
    injector.membersInjectorStore = new MembersInjectorStore(injector, listenerBindings);
    stopwatch.resetAndLog("TypeListeners creation");

    new ScopeBindingProcessor(errors).process(injector, elements);
    stopwatch.resetAndLog("Scopes creation");

    new TypeConverterBindingProcessor(errors).process(injector, elements);
    stopwatch.resetAndLog("Converters creation");

    bindInjector(injector);
    bindLogger(injector);
    bindingProcessor.process(injector, elements);
    stopwatch.resetAndLog("Binding creation");

    List<InjectorShell> injectorShells = new ArrayList<>();
    injectorShells.add(new InjectorShell(elements, injector));

    // recursively build child shells
    PrivateElementProcessor processor = new PrivateElementProcessor(errors, stage);
    processor.process(injector, elements);
    for (Builder builder : processor.getInjectorShellBuilders()) {
        injectorShells.addAll(builder.build(initializer, bindingProcessor, stopwatch, errors));
    }
    stopwatch.resetAndLog("Private environment creation");

    return injectorShells;
}
 
Example 20
Project: IPPR2016   File: ProcessStartTask.java   View Source Code Vote up 4 votes
@Override
public void execute(final ProcessStartMessage.Request msg) throws Exception {
  try {
    LOG.info("Handle ProcessStartMessage and will create new process instance");
    final ProcessInstanceBuilder processBuilder = new ProcessInstanceBuilder();

    final Optional<ProcessModel> processModel =
        Optional.ofNullable(processModelRepository.findOne(msg.getPmId()));
    if (!processModel.isPresent()) {
      throw new IllegalStateException("Could not find process model");
    }
    processBuilder.processModel(processModel.get());

    final SubjectModel starterSubjectModel = processModel.get().getStarterSubjectModel();
    final List<UserGroupAssignment> assignments = Lists.newArrayList(
        new UserGroupAssignment(starterSubjectModel.getSmId(), msg.getStartUserId(), null));

    assignments.addAll(processModel.get().getSubjectModels().stream()
        .filter(subjectModel -> !subjectModel.getSmId().equals(starterSubjectModel.getSmId()))
        .map(subjectModel -> new UserGroupAssignment(subjectModel.getSmId(), null, null))
        .collect(Collectors.toList()));

    assignments.stream().map(entry -> createSubject(processBuilder, entry))
        .forEach(subject -> subjectRepository.save((SubjectImpl) subject));

    processBuilder.startUserId(msg.getStartUserId());

    final ProcessInstance processInstance =
        processInstanceRepository.save((ProcessInstanceImpl) processBuilder.build());
    LOG.info("Created new process instance: {}", processInstance);
    callback(processInstance.getPiId());

    final ActorRef sender = getSender();
    TransactionSynchronizationManager
        .registerSynchronization(new TransactionSynchronizationAdapter() {
          @Override
          public void afterCommit() {
            // start process
            sender.tell(new ProcessStartMessage.Response(processInstance.getPiId()), getSelf());
            final long caseId = processInstance.getPiId();
            final long processModelId = processInstance.getProcessModel().getPmId();
            final String activity = "Process Start";
            final String timestamp = DateTime.now().toString("dd.MM.yyyy HH:mm");
            final EventLoggerDTO event =
                new EventLoggerDTO(caseId, processModelId, timestamp, activity, "", "", "", "", "");
            eventLoggerSender.send(event);
          }
        });
  } catch (final Exception e) {
    getSender().tell(new akka.actor.Status.Failure(e), getSelf());
  }
}