Example usage for java.util ArrayList addAll

List of usage examples for java.util ArrayList addAll

Introduction

In this page you can find the example usage for java.util ArrayList addAll.

Prototype

public boolean addAll(Collection<? extends E> c) 

Source Link

Document

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator.

Usage

From source file:com.sulacosoft.bitcoindconnector4j.BitcoindApiHandler.java

private Object deserializeResult(Method method, Object result) {
    if (result instanceof MorphDynaBean) {
        return JSONObject.toBean(JSONObject.fromObject(JSONSerializer.toJSON((MorphDynaBean) result)),
                method.getReturnType());
    } else if (result instanceof List) {
        List<?> incomingList = (List<?>) result;
        if (incomingList.size() == 0)
            return Collections.EMPTY_LIST;

        ParameterizedType type = (ParameterizedType) method.getGenericReturnType(); // method.getGenericType();
        Class<?> clazz = (Class<?>) type.getActualTypeArguments()[0];

        ArrayList<Object> outcomingList = new ArrayList<>();
        if (incomingList.get(0) instanceof MorphDynaBean) {
            for (Object entity : incomingList) {
                Object ent = JSONObject.toBean(JSONObject.fromObject(entity), clazz);
                outcomingList.add(ent);//from w ww  . j ava 2 s.  c o  m
            }
        } else {
            outcomingList.addAll(incomingList);
        }
        return outcomingList;
    } else {
        return result;
    }
}

From source file:com.amalto.workbench.providers.XSDTreeContentProvider.java

private Object[] getXSDParticleChildren(XSDParticle particle) {
    // System.out.println("getXSDParticleChildren() CLASS "+particle.getClass().getName());
    // System.out.println("getXSDParticleChildren() TERM "+particle.getTerm().getClass().getName()+": "+particle.getTerm());
    XSDTerm term = particle.getTerm();/*  w  w  w. j  a  v a  2  s  . c om*/

    if (term instanceof XSDElementDeclaration) {
        XSDTypeDefinition typeDef = ((XSDElementDeclaration) term).getTypeDefinition();
        if (typeDef == null)
            return new Object[0]; // elements with not type declaration (allowed)
        ArrayList<Object> list = new ArrayList<Object>();

        if (typeDef instanceof XSDComplexTypeDefinition) {
            list.addAll(Util.getComplexTypeDefinitionChildren((XSDComplexTypeDefinition) typeDef));
        } else {
            list.add(typeDef);
        }
        list.addAll(((XSDElementDeclaration) term).getIdentityConstraintDefinitions());
        XSDAnnotation annotation = ((XSDElementDeclaration) term).getAnnotation();
        if (filter != null && !filter.isAll()) {

        } else {
            if (annotation != null) {
                list.add(annotation);
            }
        }
        return list.toArray(new Object[list.size()]);
    }

    if (term instanceof XSDModelGroup) {// a ModelGroup skip it and get children directtly
        EList list = ((XSDModelGroup) term).getContents();
        return list.toArray(new XSDParticle[list.size()]);
    }

    if (term instanceof XSDWildcard) {
    }

    return new Object[] {};

}

From source file:com.data2semantics.yasgui.mgwtlinker.linker.PermutationMapLinker.java

/**
 * Retrieves files we should add to manifest, but which are not generated by GWT (i.e. images/js files we use separately)
 * @param logger// w w  w.ja  va 2  s  . c o  m
 * @param context
 * @return
 */
protected List<String> getDevExternalFiles(TreeLogger logger, LinkerContext context) {
    ArrayList<String> set = new ArrayList<String>(
            getExternalFilesFromDir("assets", "?" + StaticConfig.VERSION, "js", "css"));
    set.addAll(getExternalFilesFromDir("images", "?" + StaticConfig.VERSION.replace(".", ""), "png", "jpg",
            "gif"));
    set.addAll(getFontFiles());
    set.add("../dev.jsp");
    return set;
}

From source file:edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.OperatorDeepCopyVisitor.java

@Override
public ILogicalOperator visitAggregateOperator(AggregateOperator op, Void arg) throws AlgebricksException {
    ArrayList<LogicalVariable> newList = new ArrayList<LogicalVariable>();
    ArrayList<Mutable<ILogicalExpression>> newExpressions = new ArrayList<Mutable<ILogicalExpression>>();
    newList.addAll(op.getVariables());
    deepCopyExpressionRefs(newExpressions, op.getExpressions());
    return new AggregateOperator(newList, newExpressions);
}

From source file:edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.OperatorDeepCopyVisitor.java

@Override
public ILogicalOperator visitAssignOperator(AssignOperator op, Void arg) throws AlgebricksException {
    ArrayList<LogicalVariable> newList = new ArrayList<LogicalVariable>();
    ArrayList<Mutable<ILogicalExpression>> newExpressions = new ArrayList<Mutable<ILogicalExpression>>();
    newList.addAll(op.getVariables());
    deepCopyExpressionRefs(newExpressions, op.getExpressions());
    return new AssignOperator(newList, newExpressions);
}

From source file:io.hops.metadata.ndb.dalimpl.hdfs.EncodingStatusClusterj.java

@Override
public Collection<EncodingStatus> findRequestedEncodings(int limit) throws StorageException {
    Collection<EncodingStatus> normalEncodings = findWithStatus(
            EncodingStatus.Status.ENCODING_REQUESTED.ordinal(), limit);
    Collection<EncodingStatus> copyEncodings = findWithStatus(
            EncodingStatus.Status.COPY_ENCODING_REQUESTED.ordinal(), limit);
    ArrayList<EncodingStatus> requests = new ArrayList<EncodingStatus>(limit);
    requests.addAll(normalEncodings);
    requests.addAll(copyEncodings);// w w  w . j a  v  a 2 s .co m
    Collections.sort(requests, new Comparator<EncodingStatus>() {
        @Override
        public int compare(EncodingStatus o1, EncodingStatus o2) {
            return o1.getStatusModificationTime().compareTo(o2.getStatusModificationTime());
        }
    });
    return requests.subList(0, requests.size() < limit ? requests.size() : limit);
}