List of usage examples for org.apache.commons.collections CollectionUtils addAll
public static void addAll(Collection collection, Object[] elements)
From source file:nl.strohalm.cyclos.struts.access.policies.utils.GroupActionPolicy.java
private GroupActionPolicy(final Nature... natures) { this.natures = new HashSet<Nature>(); CollectionUtils.addAll(this.natures, natures); }
From source file:nl.strohalm.cyclos.utils.binding.MapBinder.java
public void readInto(final Map<K, V> map, final Object object, final boolean asString) { validateNestedBinders();// w ww . j av a2 s .c om Iterator<Object> elements = null; final Object bean = PropertyHelper.get(object, getPath()); // if (isReadFlat()) { // In this case we have separate properties, each one with a collection of values of a single property. int maxSize = 0; final List<Object> keyValues = new ArrayList<Object>(); final List<Object> valueValues = new ArrayList<Object>(); Object obj = PropertyHelper.get(bean, keyBinder.getPath()); CollectionUtils.addAll(keyValues, IteratorUtils.getIterator(obj)); obj = PropertyHelper.get(bean, valueBinder.getPath()); CollectionUtils.addAll(valueValues, IteratorUtils.getIterator(obj)); maxSize = Math.max(keyValues.size(), valueValues.size()); final List<Object> list = new ArrayList<Object>(); for (int i = 0; i < maxSize; i++) { final Map<String, Object> current = new HashMap<String, Object>(); current.put(keyBinder.getPath(), keyValues.get(i)); current.put(valueBinder.getPath(), valueValues.get(i)); list.add(current); } elements = list.iterator(); // } else { // //Here, there is a single property with a collection of values // elements = IteratorUtils.getIterator(bean); // } // Asseble the resulting collection if (elements != null) { while (elements.hasNext()) { final Object current = elements.next(); map.put(asString ? keyBinder.readFromString(current) : keyBinder.read(current), asString ? valueBinder.readFromString(current) : valueBinder.read(current)); } } }
From source file:org.amanzi.awe.nem.export.ExportedDataItems.java
private ExportedDataItems(final String name, final String fileNameFormat, final int index, final SynonymsWrapper... properties) { this.name = name; this.index = index; this.fileNameFormat = fileNameFormat; CollectionUtils.addAll(this.properties, properties); }
From source file:org.amanzi.neo.models.impl.network.NetworkModel.java
private List<Node> getNodeListFromIndex(final INodeType nodeType, final String propertyName, final Object value) throws ModelException { final List<Node> result = new ArrayList<Node>(); CollectionUtils.addAll(result, getIndexModel().getNodes(nodeType, propertyName, value)); return result; }
From source file:org.amplafi.flow.impl.BaseFlowManagement.java
/** * @see org.amplafi.flow.FlowManagement#getFlowStates() */// ww w . j a va 2 s. c om @Override public List<FlowState> getFlowStates() { List<FlowState> collection = new ArrayList<FlowState>(); CollectionUtils.addAll(collection, sessionFlows.iterator()); return collection; }
From source file:org.amplafi.hivemind.factory.mock.MockBuilderFactoryImpl.java
public void setMockOverride(Class<?>... classes) { Set<Class<?>> override = new HashSet<Class<?>>(); CollectionUtils.addAll(override, classes); setMockOverride(override);//from ww w . j a v a 2 s. c om }
From source file:org.amplafi.hivemind.factory.mock.MockBuilderFactoryImpl.java
public void addMockOverride(Class<?>... classes) { Set<Class<?>> override = getMockOverride(); if (override == null) { setMockOverride(classes);//from w w w .ja v a2 s.com } else { CollectionUtils.addAll(override, classes); } }
From source file:org.amplafi.hivemind.factory.mock.MockBuilderFactoryImpl.java
public void setDontMockOverride(Class<?>... classes) { Set<Class<?>> dontOverride = new HashSet<Class<?>>(); CollectionUtils.addAll(dontOverride, classes); setDontMockOverride(dontOverride);/*from w w w .j av a 2 s . co m*/ }
From source file:org.amplafi.hivemind.factory.mock.MockBuilderFactoryImpl.java
public void addDontMockOverride(Class<?>... classes) { Set<Class<?>> dontOverride = getDontMockOverride(); if (dontOverride == null) { setDontMockOverride(classes);//from ww w. java 2 s . c o m } else { CollectionUtils.addAll(dontOverride, classes); } }
From source file:org.apache.cayenne.ashwood.graph.StrongConnection.java
public Digraph<Collection<E>, Collection<V>> contract(Digraph<Collection<E>, Collection<V>> contractedDigraph) { Collection<Collection<E>> components = new ArrayList<>(); CollectionUtils.addAll(components, this); Map<E, Collection<E>> memberToComponent = new HashMap<>(); for (Collection<E> c : components) { for (E e : c) { memberToComponent.put(e, c); }// w w w . j a v a 2 s .c o m } for (Collection<E> origin : components) { contractedDigraph.addVertex(origin); for (E member : origin) { for (ArcIterator<E, V> k = digraph.outgoingIterator(member); k.hasNext();) { V arc = k.next(); E dst = k.getDestination(); if (origin.contains(dst)) continue; Collection<E> destination = memberToComponent.get(dst); Collection<V> contractedArc = contractedDigraph.getArc(origin, destination); if (contractedArc == null) { contractedArc = Collections.singletonList(arc); contractedDigraph.putArc(origin, destination, contractedArc); } else { if (contractedArc.size() == 1) { Collection<V> tmp = contractedArc; contractedArc = new ArrayList<>(); contractedArc.addAll(tmp); contractedDigraph.putArc(origin, destination, contractedArc); } contractedArc.add(arc); } } } } return contractedDigraph; }