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.parse.ParseAddOperation.java

@Override
public Object apply(Object oldValue, String key) {
    if (oldValue == null) {
        return objects;
    } else if (oldValue instanceof JSONArray) {
        ArrayList<Object> old = ParseFieldOperations.jsonArrayAsArrayList((JSONArray) oldValue);
        @SuppressWarnings("unchecked")
        ArrayList<Object> newValue = (ArrayList<Object>) this.apply(old, key);
        return new JSONArray(newValue);
    } else if (oldValue instanceof List) {
        ArrayList<Object> result = new ArrayList<>((List<?>) oldValue);
        result.addAll(objects);
        return result;
    } else {//from w ww  . jav a2  s.  c  om
        throw new IllegalArgumentException("Operation is invalid after previous operation.");
    }
}

From source file:simulation.LoadBalancer.java

private void pulseNextGroup() {
    try {/*w w  w . ja  va2s.  c  o  m*/
        ArrayList<SimVehicle> vehicles = new ArrayList<>();
        vehicles.addAll(vehicleLists.get(pulseGroup));
        for (SimVehicle v : vehicles) {
            String httpPost = "http://192.168.24.120:8080/pol?license_plate=" + v.getVehicle().getID() + "&lat="
                    + v.getLocation().getY() + "&lng=" + v.getLocation().getX() + "&timestamp="
                    + v.getTimestamp();
            try {
                HttpUriRequest request = new HttpPost(httpPost);
                HttpClientBuilder.create().build().execute(request);
            } catch (IOException e) {
                e.printStackTrace();
                System.out.println(e);
            }
        }
    } catch (Throwable t) {
        t.printStackTrace();
    }
    System.out.println("Group pulsed:" + pulseGroup + " Amount of cars:" + vehicleLists.get(pulseGroup).size());
    vehicleLists.get(pulseGroup).clear();

    if (pulseGroup < 14) {
        pulseGroup++;
    } else {
        pulseGroup = 0;
    }
}

From source file:de.ub0r.android.websms.connector.common.Utils.java

/**
 * Get {@link Cookie}s stored in static {@link CookieStore}.
 * /*from  w  ww  . j  a v  a2 s  .  c  o  m*/
 * @return {@link ArrayList} of {@link Cookie}s
 */
public static ArrayList<Cookie> getCookies() {
    if (httpClient == null) {
        return null;
    }
    List<Cookie> cookies = httpClient.getCookieStore().getCookies();
    if (cookies == null || cookies.size() == 0) {
        return null;
    }
    ArrayList<Cookie> ret = new ArrayList<Cookie>(cookies.size());
    ret.addAll(cookies);
    return ret;
}

From source file:com.ok2c.lightmtp.protocol.BasicDeliveryResult.java

public BasicDeliveryResult(final SMTPReply reply, final List<RcptResult> rcptFailures) {
    super();//from w  w w.  j  av  a  2  s.  c o m
    Args.notNull(reply, "SMTP reply");
    this.reply = reply;
    ArrayList<RcptResult> list = new ArrayList<RcptResult>();
    if (rcptFailures != null) {
        list.addAll(rcptFailures);
    }
    this.failures = Collections.unmodifiableList(list);
}

From source file:logic.LogicaTorneo.java

public List<Jugador> getJugadores(int id) {
    ArrayList<Jugador> l = new ArrayList<>();
    l.addAll(torneoRepository.findOne(id).getJugadoreses());
    return l;//ww w . j  a  v a2s  . c o m
}

From source file:edu.duke.cabig.c3pr.service.impl.RulesDelegationServiceImpl.java

public void activateRules(NotificationEventTypeEnum event, List<Object> objects) {

    log.debug(this.getClass().getName() + ": Entering activateRules()");
    ArrayList<Object> objList = new ArrayList<Object>();
    objList.addAll(objects);
    objList.add(schedulerService);//from www .  j  a  v  a  2s .c o  m
    objList.add(scheduledNotificationService);
    objList.add(event);

    try {
        if (event != null) {
            businessRulesExecutionService.fireRules("edu.duke.cabig.c3pr.rules.deploy.study_status_rules",
                    objList);
        }
    } catch (RuleException re) {
        log.error(re.getMessage());
    }
    log.debug(this.getClass().getName() + ": Exiting activateRules()");
}

From source file:com.boundary.sdk.snmp.metric.PollerEntry.java

public List<Long> getHostListIds() {
    Set<Long> ids = new LinkedHashSet<Long>();
    for (HostListRef ref : hostLists) {
        if (ref.isEnabled()) {
            ids.add(ref.getId());//from w w  w .j  a v  a  2s  .com
        }
    }

    ArrayList<Long> list = new ArrayList<Long>();
    list.addAll(ids);
    return list;
}

From source file:com.boundary.sdk.snmp.metric.PollerEntry.java

public List<Long> getOidListIds() {
    Set<Long> ids = new LinkedHashSet<Long>();
    for (OidMapListRef ref : oidLists) {
        if (ref.isEnabled()) {
            ids.add(ref.getId());/*  w w  w  .j a v a  2  s  .  c o m*/
        }
    }

    ArrayList<Long> list = new ArrayList<Long>();
    list.addAll(ids);
    return list;
}

From source file:com.epam.ta.reportportal.core.widget.content.BugTrendChartContentLoader.java

@Override
public Map<String, List<ChartObject>> loadContent(Filter filter, Sort sorting, int quantity,
        List<String> contentFields, List<String> metaDataFields, Map<String, List<String>> options) {

    StatisticsDocumentHandler statisticsDocumentHandler = new StatisticsDocumentHandler(contentFields,
            metaDataFields);//ww w . j  av a  2 s. c o  m
    if (filter.getTarget().equals(TestItem.class))
        return new HashMap<>();
    ArrayList<String> allFields = new ArrayList<>(contentFields);
    allFields.addAll(metaDataFields);
    launchRepository.loadWithCallback(filter, sorting, quantity, allFields, statisticsDocumentHandler,
            COLLECTION_NAME);
    List<ChartObject> result = statisticsDocumentHandler.getResult();

    return assembleWidgetData(result);
}

From source file:com.yarg.animatronics.datamodel.PwmBoard.java

/**
 * Get a copy of all of the attached motors.
 * @return Copy of all of the attached motors.
 *///w  w w .  ja  va  2s.c  om
public List<PwmMotor> getAttachedMotors() {
    ArrayList<PwmMotor> motorsCopy = new ArrayList<>();
    motorsCopy.addAll(motors);
    return motorsCopy;
}