Example usage for java.util Collection addAll

List of usage examples for java.util Collection addAll

Introduction

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

Prototype

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

Source Link

Document

Adds all of the elements in the specified collection to this collection (optional operation).

Usage

From source file:edu.uci.ics.jung.graph.DirectedSparseGraph.java

public Collection<V> getNeighbors(V vertex) {
    if (!containsVertex(vertex))
        return null;

    Collection<V> neighbors = new HashSet<V>();
    neighbors.addAll(getPreds_internal(vertex));
    neighbors.addAll(getSuccs_internal(vertex));
    return Collections.unmodifiableCollection(neighbors);
}

From source file:org.owasp.webgoat.plugin.StoredXssComments.java

@RequestMapping(method = GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = ALL_VALUE)
@ResponseBody/*from w w  w .j av a  2 s.c  om*/
public Collection<Comment> retrieveComments() {
    Collection<Comment> allComments = Lists.newArrayList();
    Collection<Comment> newComments = userComments.get(webSession.getUserName());
    if (newComments != null) {
        allComments.addAll(newComments);
    }

    allComments.addAll(comments);

    return allComments;
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.phd.coordinator.providers.CurricularCourseDegreeExecutionSemesterProvider.java

@Override
public Object provide(Object source, Object currentValue) {
    final ManageEnrolmentsBean bean = (ManageEnrolmentsBean) source;

    final Collection<ExecutionSemester> result = new TreeSet<ExecutionSemester>(new ReverseComparator());

    for (final ExecutionYear executionYear : bean.getCurricularCourse().getDegreeCurricularPlan()
            .getExecutionYears()) {/*from   w  w w.  j  a  v a 2 s .  c  om*/
        result.addAll(executionYear.getExecutionPeriodsSet());
    }

    return result;
}

From source file:com.marklogic.entityservices.TestSetup.java

public void teardownClass() {
    JSONDocumentManager docMgr = _client.newJSONDocumentManager();
    for (File f : testCaseFiles) {
        logger.info("Removing " + f.getName());
        docMgr.delete(f.getName());/* www. j av a 2 s  . c o  m*/
    }

    Collection<File> sourceFiles = getTestResources("/source-documents");
    Collection<File> testDocuments = getTestResources("/test-instances");
    Collection<File> testInvalidFiles = getTestResources("/invalid-entity-types");
    Collection<File> extraDocuments = new ArrayList<File>();
    extraDocuments.addAll(testDocuments);
    extraDocuments.addAll(sourceFiles);
    extraDocuments.addAll(testInvalidFiles);

    for (File f : extraDocuments) {
        docMgr.delete(f.getName());
    }
}

From source file:edu.uci.ics.jung.graph.DirectedSparseGraph.java

public Collection<E> getIncidentEdges(V vertex) {
    if (!containsVertex(vertex))
        return null;

    Collection<E> incident_edges = new HashSet<E>();
    incident_edges.addAll(getIncoming_internal(vertex));
    incident_edges.addAll(getOutgoing_internal(vertex));
    return Collections.unmodifiableCollection(incident_edges);
}

From source file:com.wrightfully.sonar.plugins.dotnet.resharper.ReSharperConfiguration.java

private String[] splitUsingSemiColon(String[] strings) {
    Collection<String> resultCollection = Lists.newArrayList();
    for (int i = 0; i < strings.length; i++) {
        resultCollection.addAll(Arrays.asList(StringUtils.split(strings[i], ';')));
    }//ww w  . ja  v a  2s .co  m
    return resultCollection.toArray(new String[resultCollection.size()]);
}

From source file:com.nextep.designer.vcs.services.impl.DependencyService.java

@Override
public Collection<IReferencer> getReferencersAfterDeletion(IReferenceable ref, Collection<IReferencer> deps,
        Collection<IReferencer> deletedReferencers) {
    // Copying collection because we will alter it
    Collection<IReferencer> dependencies = new ArrayList<IReferencer>(deps);
    if (dependencies != null && dependencies.size() > 0) {
        // If the removed object is a reference container, we remove dependencies
        // which are declared by the removed object. Only to allow removal of objects
        // which have only dependencies to themselves.
        if (ref instanceof IReferenceContainer) {
            Collection<IReference> declaredRefs = new ArrayList<IReference>();
            declaredRefs.addAll(((IReferenceContainer) ref).getReferenceMap().keySet());
            declaredRefs.add(ref.getReference());
            for (IReferencer depRef : new ArrayList<IReferencer>(dependencies)) {
                if (depRef instanceof IReferenceable
                        && declaredRefs.contains(((IReferenceable) depRef).getReference())) {
                    dependencies.remove(depRef);
                }//from www.j a v  a  2s . c  o  m
                // Also removing residual container references
                if (depRef instanceof ITypedObject && ((ITypedObject) depRef).getType() == IElementType
                        .getInstance(IVersionContainer.TYPE_ID)) {
                    dependencies.remove(depRef);
                }
            }
        }
        dependencies.removeAll(deletedReferencers);
        // Removing encapsulating dependencies:
        // A table containing a FK will generate 2 dependencies, one from the table, the
        // other from the FK
        // For all remaining dependencies
        for (IReferencer r : new ArrayList<IReferencer>(dependencies)) {
            // If one is a container of referenceable instances
            if (r instanceof IReferenceContainer) {
                // Then we check if this instance is one of the deleted referencers,
                // in which case we "assume"
                // that the upper dependency is no longer valid
                final Collection<IReferenceable> containedItems = ((IReferenceContainer) r).getReferenceMap()
                        .values();
                for (IReferenceable item : containedItems) {
                    if (deletedReferencers.contains(item)) {
                        dependencies.remove(r);
                    }
                    if (dependencies.contains(item)) {
                        dependencies.remove(r);
                    }
                }
            }
        }
    }
    return dependencies;
}

From source file:org.owasp.webgoat.plugin.ForgedReviews.java

@RequestMapping(method = GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = ALL_VALUE)
@ResponseBody/*from  w  ww  .ja  va  2  s. c  o m*/
public Collection<Review> retrieveReviews() {
    Collection<Review> allReviews = Lists.newArrayList();
    Collection<Review> newReviews = userReviews.get(webSession.getUserName());
    if (newReviews != null) {
        allReviews.addAll(newReviews);
    }

    allReviews.addAll(REVIEWS);

    return allReviews;
}

From source file:de.interseroh.report.auth.ReportServiceBean.java

@Transactional(readOnly = true)
@Override//from  w w w  .  j  a  va 2s  .c  om
public Collection<Report> findReportsByUser(String email) {
    Collection<UserRoleEntity> userRoles = userRoleRepository.findByUserEmail(email);

    Collection<Report> allReports = new ArrayList<Report>();
    for (UserRoleEntity userRoleEntity : userRoles) {
        Role currentRole = userRoleEntity.getRole();
        Collection<Report> reports = currentRole.getReports();
        allReports.addAll(reports);
    }

    return allReports;
}

From source file:com.assemblade.server.model.AbstractUser.java

@Override
public Collection<String> getAttributeNames() {
    Collection<String> attributeNames = super.getAttributeNames();
    attributeNames.addAll(Arrays.asList("uid", "cn", "userPassword", "mail", "isMemberOf", "aclRights",
            "ds-pwp-password-policy-dn"));
    return attributeNames;
}