Example usage for org.apache.commons.collections CollectionUtils addAll

List of usage examples for org.apache.commons.collections CollectionUtils addAll

Introduction

In this page you can find the example usage for org.apache.commons.collections CollectionUtils addAll.

Prototype

public static void addAll(Collection collection, Object[] elements) 

Source Link

Document

Adds all elements in the array to the given collection.

Usage

From source file:org.drools.planner.core.heuristic.selector.entity.cached.FilteringEntitySelector.java

public void constructCache(DefaultSolverScope solverScope) {
    long childSize = childEntitySelector.getSize();
    cachedEntityList = new ArrayList<Object>((int) childSize);
    CollectionUtils.addAll(cachedEntityList, childEntitySelector.iterator());
}

From source file:org.drools.planner.core.heuristic.selector.entity.decorator.DecreasingDifficultyEntitySelector.java

@Override
public void constructCache(DefaultSolverScope solverScope) {
    long childSize = childEntitySelector.getSize();
    cachedEntityList = new ArrayList<Object>((int) childSize);
    CollectionUtils.addAll(cachedEntityList, childEntitySelector.iterator());
    planningEntitySorter.sortDifficultyDescending(solverScope.getWorkingSolution(), cachedEntityList);
}

From source file:org.drools.planner.core.heuristic.selector.move.cached.CachingMoveSelector.java

public void constructCache(DefaultSolverScope solverScope) {
    cachedSize = childMoveSelector.getSize();
    if (cachedSize > (long) Integer.MAX_VALUE) {
        throw new IllegalStateException(
                "The moveSelector (" + this + ") has a childMoveSelector (" + childMoveSelector
                        + ") with cachedSize (" + cachedSize + ") which is higher then Integer.MAX_VALUE.");
    }/*  w  w  w.  j a  v  a2 s .  c o  m*/
    cachedMoveList = new ArrayList<Move>((int) cachedSize);
    CollectionUtils.addAll(cachedMoveList, childMoveSelector.iterator());
    orderCache(solverScope);
}

From source file:org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassAndPropertiesUiContentProvider.java

List<PropertyAdapter> getChoosenProperties0() {
    List<PropertyAdapter> properties = Lists.newArrayList();
    CollectionUtils.addAll(properties, m_propertiesViewer.getCheckedElements());
    return properties;
}

From source file:org.eclipse.wb.internal.core.utils.binding.editors.StringListEditor.java

public void setValue(Object value) {
    String stringValue = ObjectUtils.toString(value);
    String[] values = StringUtils.split(stringValue, m_separator);
    List elements = new ArrayList();
    CollectionUtils.addAll(elements, values);
    m_field.setElements(elements);/*  w  w  w  .  ja v  a 2s  .co  m*/
}

From source file:org.eclipse.wb.internal.core.utils.dialogfields.ComboDialogField.java

private void doSelectionChanged(SelectionEvent e) {
    if (isOkToUse(fComboControl)) {
        fItems = new ArrayList();
        CollectionUtils.addAll(fItems, fComboControl.getItems());
        ////from w w w  .j  a  va  2  s  .  c o m
        fText = fComboControl.getText();
        fSelectionIndex = fComboControl.getSelectionIndex();
    }
    dialogFieldChanged();
}

From source file:org.eclipse.wb.internal.core.utils.dialogfields.ComboDialogField.java

/**
 * Sets the combo items. Triggers a dialog-changed event.
 *///from w  ww .j  av a  2s. c  o  m
public void setItems(String[] items) {
    fItems = new ArrayList();
    CollectionUtils.addAll(fItems, items);
    //
    if (isOkToUse(fComboControl)) {
        doSetItems();
        fComboControl.setItems(items);
    }
    dialogFieldChanged();
}

From source file:org.eclipse.wb.internal.core.utils.external.ExternalFactoriesHelper.java

/**
 * @return extensions for given point ID.
 * /*from w ww . j a  v  a 2s . c om*/
 * @param pointId
 *          the ID of extension point to get extensions for.
 */
private static List<IExtension> getExtensions(String pointId) {
    List<IExtension> extensions = m_extensions.get(pointId);
    if (extensions == null) {
        extensions = Lists.newArrayList();
        m_extensions.put(pointId, extensions);
        IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(pointId);
        if (extensionPoint != null) {
            CollectionUtils.addAll(extensions, extensionPoint.getExtensions());
        }
    }
    return extensions;
}

From source file:org.eclipse.wb.internal.core.utils.jdt.core.ProjectUtils.java

/**
 * Add libraries of given plugin to the classpath of {@link IJavaProject}.
 * /*  www .  j  a  va 2  s.  c o m*/
 * @param javaProject
 *          the {@link IJavaProject} to add libraries to.
 * @param pluginId
 *          the plugin id.
 */
public static void addPluginLibraries(IJavaProject javaProject, String pluginId) throws Exception {
    List<IClasspathEntry> entries = Lists.newArrayList();
    // add existing entries
    CollectionUtils.addAll(entries, javaProject.getRawClasspath());
    // add plugin entries
    ReflectivePDE.addPluginLibraries(pluginId, entries);
    // set new entries
    setRawClasspath(javaProject, entries);
}

From source file:org.eclipse.wb.internal.core.utils.jdt.core.ProjectUtils.java

/**
 * Adds nature to the {@link IProject}./*from w  ww. j  av  a 2s  . com*/
 */
public static void addNature(IProject project, String natureId) throws Exception {
    IProjectDescription description = project.getDescription();
    //
    List<String> natureIds = Lists.newArrayList();
    CollectionUtils.addAll(natureIds, description.getNatureIds());
    natureIds.add(natureId);
    description.setNatureIds(natureIds.toArray(new String[natureIds.size()]));
    //
    project.setDescription(description, null);
}