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:au.org.ala.fielddata.mobile.SurveyBuilder.java

private Spinner buildSpinner(Attribute attribute, ViewGroup parent) {

    ViewGroup row = (ViewGroup) viewContext.getLayoutInflater().inflate(R.layout.input_spinner_view, parent);

    Spinner spinner = (Spinner) row.findViewById(R.id.spinner);
    spinner.setPrompt("Select " + attribute.description);
    ArrayList<AttributeOption> options = new ArrayList<Attribute.AttributeOption>(attribute.options.length + 1);
    options.addAll(Arrays.asList(attribute.options));

    ArrayAdapter<AttributeOption> adapter = new ArrayAdapter<AttributeOption>(viewContext,
            R.layout.multiline_spinner_item, options);
    adapter.setDropDownViewResource(R.layout.multiline_spinner_dropdown_item);
    spinner.setAdapter(adapter);/*from w  ww.  ja  v  a  2 s  . c o m*/

    return spinner;
}

From source file:com.pindroid.syncadapter.BookmarkSyncAdapter.java

private ArrayList<Bookmark> getBookmarkList()
        throws AuthenticationException, IOException, TooManyRequestsException, PinboardException {
    int pageSize = Constants.BOOKMARK_PAGE_SIZE;
    ArrayList<Bookmark> results = new ArrayList<Bookmark>();

    int page = 0;
    boolean morePages = true;

    do {//from ww w  .  j a  v a 2  s . c o m
        morePages = results
                .addAll(PinboardApi.getAllBookmarks(null, page++ * pageSize, pageSize, mAccount, mContext));
    } while (morePages);

    return results;
}

From source file:com.brightcove.com.uploader.verifier.RetrieveJSONResponseforVideo.java

public ArrayList<Object> getCustomFields() {
    ArrayList<Object> metadata = getMetaData("customFields");
    ArrayList<Object> customFields = new ArrayList<Object>();
    for (Object customField : metadata) {
        if (!customField.equals("null")) {
            JsonNode node = (JsonNode) customField;
            RetrieveJSONNodeHelper helper = new RetrieveJSONNodeHelper(node);
            customFields.addAll(helper.retrieveAllMetaDataFromJSONResponse());
        }/*w  w  w  .j  a  v a 2s  .  co  m*/
    }
    return customFields;
}

From source file:at.gv.egiz.bku.local.stal.LocalSecureViewer.java

/**
 *
 * @param signedInfo/*from  w w  w.  jav  a 2 s  . c o  m*/
 * @param okListener
 * @param okCommand
 * @throws java.lang.Exception
 */
@Override
public void displayDataToBeSigned(SignatureInfo signedInfo, ActionListener okListener, String okCommand)
        throws Exception {

    log.info("Retrieve data to be signed for dsig:SignedInfo {}.", signedInfo.getId());
    List<HashDataInput> hdi = getHashDataInputs(signedInfo);
    List<HashDataInput> verifiedDataToBeSigned = verifyHashDataInput(signedInfo.getReference(), hdi.get(0));

    ArrayList<HashDataInput> selectedHashDataInputs = new ArrayList<HashDataInput>();
    selectedHashDataInputs.addAll(verifiedDataToBeSigned);

    if (selectedHashDataInputs.size() < 1) {
        log.error("dsig:SignedInfo does not contain a data reference.");
        throw new Exception("dsig:SignedInfo does not contain a data reference.");
    }
    gui.showSecureViewer(selectedHashDataInputs, okListener, okCommand, this);
}

From source file:edu.valelab.GaussianFit.CoordinateMapper.java

/**
 * Feeds control points into this class//from   www  . j a va  2 s.  c  o  m
 * Performs initial calculations for lwm and affine transforms
 * 
 */
public CoordinateMapper(PointMap pointMap, int order, int method) {
    pointMap_ = pointMap;
    order_ = order;
    method_ = method;

    // Set up LWM
    exponentPairs_ = polynomialExponents(order);
    final ArrayList<Point2D.Double> keys = new ArrayList<Point2D.Double>();
    keys.addAll(pointMap.keySet());
    final Point2D.Double[] keyArray = keys.toArray(new Point2D.Double[] {});
    kdTree_ = new EnhancedKDTree(keyArray);
    controlPoints_ = createControlPoints(kdTree_, order_, pointMap_);

    // Set up Affine transform
    af_ = generateAffineTransformFromPointPairs(pointMap);

    // set up Rigid Body
    rbAf_ = generateRigidBodyTransform(pointMap);

}

From source file:com.example.app.repository.ui.ResourceRepositoryItemSelector.java

@SuppressWarnings("Duplicates")
@Override/*  w w w. j  av a 2 s  .  co m*/
protected void addSearchConstraints(SearchModelImpl searchModel) {
    searchModel.getConstraints()
            .add(new SimpleConstraint("name").withLabel(LABEL_NAME())
                    .withProperty(ResourceRepositoryItem.RESOURCE_PROP + '.' + Resource.NAME_COLUMN_PROP)
                    .withOperator(PropertyConstraint.Operator.like));

    searchModel.getConstraints()
            .add(new ComboBoxConstraint(nullFirst(RepositoryItemStatus.values()), RepositoryItemStatus.Active,
                    new CustomCellRenderer(CommonButtonText.ANY)).withLabel(CommonColumnText.STATUS)
                            .withProperty(ResourceRepositoryItem.STATUS_COLUMN_PROP)
                            .withOperator(PropertyConstraint.Operator.eq));

    ArrayList<Label> categories = new ArrayList<>();
    categories.add(null);
    categories.addAll(_rclp.getEnabledLabels(Optional.empty()));
    AbstractPropertyConstraint categoryConstraint = new ComboBoxConstraint(categories, null,
            CommonButtonText.ANY) {
        @Override
        public void addCriteria(QLBuilder builder, Component constraintComponent) {
            ComboBox component = (ComboBox) constraintComponent;
            Label category = (Label) component.getSelectedObject();
            if (category != null && shouldReturnConstraintForValue(category)) {
                String categoriesPropPath = builder.getAlias() + '.' + ResourceRepositoryItem.RESOURCE_PROP
                        + '.' + Resource.TAGS_PROP;
                builder.appendCriteria(":category in elements(" + categoriesPropPath + ')')
                        .putParameter("category", category);
            }
        }
    }.withLabel(LABEL_CATEGORY());
    searchModel.getConstraints().add(categoryConstraint);

    searchModel.getConstraints()
            .add(new SimpleConstraint("author").withLabel(LABEL_AUTHOR())
                    .withProperty(ResourceRepositoryItem.RESOURCE_PROP + '.' + Resource.AUTHOR_COLUMN_PROP)
                    .withOperator(PropertyConstraint.Operator.like));

    ArrayList<Label> types = new ArrayList<>();
    types.add(null);
    types.addAll(_rtlp.getEnabledLabels(Optional.empty()));
    AbstractPropertyConstraint typeConstraint = new ComboBoxConstraint(types, null, CommonButtonText.ANY)
            .withLabel(LABEL_TYPE())
            .withProperty(ResourceRepositoryItem.RESOURCE_PROP + '.' + Resource.CATEGORY_PROP)
            .withOperator(PropertyConstraint.Operator.eq).withCoerceValue(false).withValueType(Label.class);
    searchModel.getConstraints().add(typeConstraint);
}

From source file:com.mobisys.android.ibp.ObservationRequestQueue.java

private void submitObservation(final boolean single, final ObservationInstance sp, final Context context) {
    Bundle b = new Bundle();
    if (sp.getId() != -1)
        b.putString(Request.OBV_ID, String.valueOf(sp.getId()));

    b.putString(Request.SPECIES_GROUP_ID, String.valueOf(sp.getGroup().getId()));
    b.putString(Request.HABITAT_ID, String.valueOf(sp.getHabitatId()));
    String date = AppUtil.getStringFromDate(sp.getFromDate(), Constants.DATE_FORMAT);
    b.putString(Request.FROM_DATE, date);
    b.putString(Request.PLACE_NAME, sp.getPlaceName());
    b.putString(Request.AREAS, sp.getAreas());
    b.putString(Request.NOTES, sp.getNotes());
    if (sp.getMaxVotedReco().getCommonName().length() > 0)
        b.putString(Request.COMMON_NAME, sp.getMaxVotedReco().getCommonName());
    if (sp.getMaxVotedReco().getScientificName().length() > 0)
        b.putString(Request.SCI_NAME, sp.getMaxVotedReco().getScientificName());
    b.putString(Request.RESOURCE_LIST_TYPE, Constants.RESOURCE_LIST_TYPE);
    b.putString(Request.AGREE_TERMS, Constants.AGREE_TERMS_VALUE);

    ArrayList<String> imageStringPath = new ArrayList<String>();
    ArrayList<String> mImageType = new ArrayList<String>();
    ArrayList<Resource> mResourceList = new ArrayList<Resource>();
    mResourceList.addAll(sp.getResource());
    /*if(sp.getResources()!=null){
       String[] items = sp.getResources().split(",");
        for (String item : items){/*from   w  w  w . j  a  v  a2  s .  c  o  m*/
      resources.add(item);
        }
    }*/

    /*if(sp.getImageType()!=null){
       String[] imageT = sp.getImageType().split(",");
        for (String item : imageT){
     imageType.add(item);
        }
    }*/

    if (mResourceList != null && mResourceList.size() > 0) {
        for (int i = 0; i < mResourceList.size(); i++) {
            if (mResourceList.get(i).getUri() != null && mResourceList.get(i).isDirty()) { //while edit add uri and url to imagepath
                String imagepath = AppUtil.getRealPathFromURI(Uri.parse(mResourceList.get(i).getUri()),
                        context);
                if (Preferences.DEBUG)
                    Log.d("ObsRequestQ", "***image path:" + imagepath);
                imageStringPath.add(imagepath);

                String imageType = AppUtil.GetMimeType(context, Uri.parse(mResourceList.get(i).getUri()));
                if (Preferences.DEBUG)
                    Log.d("ObsRequestQ", "***image type: " + imageType);
                mImageType.add(imageType);
            } else {
                if (mResourceList.get(i).getUrl() != null) {
                    imageStringPath.add(mResourceList.get(i).getUrl());
                    mImageType.add("null");
                }
            }
        }
    }
    uploadImage(single, b, context, imageStringPath, mImageType, sp);
}

From source file:com.thoughtworks.webanalyticsautomation.Engine.java

private ArrayList<String> getListOfMissingTagsInActualSections(ArrayList<Section> actualSectionList,
        Section expectedSection) {/* w  w  w . ja  v a2  s . c  om*/
    ArrayList<String> errorList = new ArrayList<String>();
    int actualNumberOfEventsTriggered = actualSectionList.size();
    int expectedNumberOfEventsToBeTriggered = expectedSection.getNumberOfEventsTriggered();
    errorList.addAll(verifyNumberOfEventsForEachExpectedSection(actualNumberOfEventsTriggered,
            expectedNumberOfEventsToBeTriggered));
    errorList.addAll(verifyTagsForEachExpectedSection(actualSectionList, expectedSection));
    return errorList;
}

From source file:es.tekniker.framework.ktek.drugtreatment.mng.server.DrugTreatmentMngServer.java

public KtekMonitoringQuestionnaireModelEntityList getQuestionnaireListCompleted4IdUser(int idUserAccessed,
        int idUser, String codtelecareprogram4User, int idlang) throws KtekExceptionEntity {
    log.info("getQuestionnaireListCompleted4IdUser");
    KtekMonitoringQuestionnaireModelEntityList list = null;
    KtekMonitoringQuestionnaireModelEntityList listDrugFollowUp = null;
    KtekMonitoringQuestionnaireModelEntityList listDrugSideEffects = null;
    QuestionnaireMngServer server = null;
    KtekQuestionnaireModelEntity[] arrayDrugFollowUp = null;
    KtekQuestionnaireModelEntity[] arrayDrugSideEffects = null;

    short status = KtekQuestionnaireStatus.QUESTIONNAIRE_STATUS_COMPLETED;
    short typeMonitoringActivityDrugFollowUp = KtekApplicationitemType.DRUGFOLLOWUP;
    short typeMonitoringActivityDrugSideEffects = KtekApplicationitemType.DRUGSIDEEFFECTS;

    server = new QuestionnaireMngServer();
    arrayDrugFollowUp = server.getQuestionnaires4TypeMonitoringActivityPlannedByUserId(idUserAccessed,
            codtelecareprogram4User, idlang, typeMonitoringActivityDrugFollowUp, status);

    if (arrayDrugFollowUp != null)
        log.info("getQuestionnaireListCompleted4IdUser arrayDrugFollowUp instance is not null "
                + arrayDrugFollowUp.length);
    else//from ww  w . ja  v a2s.co  m
        log.info("getQuestionnaireListCompleted4IdUser arrayDrugFollowUp instance is null");

    arrayDrugSideEffects = server.getQuestionnaires4TypeMonitoringActivityPlannedByUserId(idUserAccessed,
            codtelecareprogram4User, idlang, typeMonitoringActivityDrugSideEffects, status);
    if (arrayDrugSideEffects != null)
        log.info("getQuestionnaireListCompleted4IdUser arrayDrugSideEffects instance is not null "
                + arrayDrugSideEffects.length);
    else
        log.info("getQuestionnaireListCompleted4IdUser arrayDrugSideEffects instance is null");

    if (arrayDrugFollowUp != null && arrayDrugFollowUp.length > 0)
        listDrugFollowUp = UtilsQuestionnaire.array2List(arrayDrugFollowUp);

    if (arrayDrugSideEffects != null && arrayDrugSideEffects.length > 0)
        listDrugSideEffects = UtilsQuestionnaire.array2List(arrayDrugSideEffects);

    list = new KtekMonitoringQuestionnaireModelEntityList();

    ArrayList<KtekMonitoringQuestionnaireModelEntity> innerlist = new ArrayList<KtekMonitoringQuestionnaireModelEntity>();
    if (listDrugFollowUp != null)
        innerlist.addAll(listDrugFollowUp.getList());

    if (listDrugSideEffects != null)
        innerlist.addAll(listDrugSideEffects.getList());

    list.setList(innerlist);

    //audit
    int idaccessuser = 0, idaccesseduser = 0;
    short typeaction = KtekAuditAccessLogTypeAction.ACCESS_SIDE_EFFECTS_LOG;
    int idaction = 0;
    long logitemcreation = Utils.getCalendarGMT().getTimeInMillis();
    String codtelecareprogram = codtelecareprogram4User;

    idaccessuser = idUser;
    idaccesseduser = idUserAccessed;
    UtilsQuestionnaire.auditAccessLog(idaccessuser, idaccesseduser, codtelecareprogram, typeaction, idaction,
            logitemcreation);

    return list;
}

From source file:edu.usf.cutr.opentripplanner.android.tasks.OTPGeocoding.java

private ArrayList<Address> searchPlaces(String name) {
    HashMap<String, String> params = new HashMap<String, String>();
    Places p;//from w w  w. j a v a  2s  . c  o  m

    /*params.put(Itract.PARAM_NAME, name);
    if (selectedServer != null) {
       params.put(Itract.PARAM_LAT, Double.toString(selectedServer.getGeometricalCenterLatitude()));
       params.put(Itract.PARAM_LON, Double.toString(selectedServer.getGeometricalCenterLongitude()));
    }
    p = new Itract();*/

    if (placesService.equals(context.getResources().getString(R.string.geocoder_google_places))) {
        params.put(GooglePlaces.PARAM_NAME, name);
        if (selectedServer != null) {
            params.put(GooglePlaces.PARAM_LOCATION,
                    Double.toString(selectedServer.getGeometricalCenterLatitude()) + ","
                            + Double.toString(selectedServer.getGeometricalCenterLongitude()));
            params.put(GooglePlaces.PARAM_RADIUS, Double.toString(selectedServer.getRadius()));
        }
        p = new GooglePlaces(getKeyFromResource());

        Log.v(TAG, "Using Google Places!");
    } else {
        params.put(Nominatim.PARAM_NAME, name);
        if (selectedServer != null) {
            params.put(Nominatim.PARAM_LEFT, Double.toString(selectedServer.getLowerLeftLongitude()));
            params.put(Nominatim.PARAM_TOP, Double.toString(selectedServer.getLowerLeftLatitude()));
            params.put(Nominatim.PARAM_RIGHT, Double.toString(selectedServer.getUpperRightLongitude()));
            params.put(Nominatim.PARAM_BOTTOM, Double.toString(selectedServer.getUpperRightLatitude()));
        }

        p = new Nominatim();

        Log.v(TAG, "Using Nominatim!");
    }

    ArrayList<POI> pois = new ArrayList<POI>();
    pois.addAll(p.getPlaces(params));

    ArrayList<Address> addresses = new ArrayList<Address>();

    for (int i = 0; i < pois.size(); i++) {
        POI poi = pois.get(i);
        Log.v(TAG, poi.getName() + " " + poi.getLatitude() + "," + poi.getLongitude());
        Address addr = new Address(context.getResources().getConfiguration().locale);
        addr.setLatitude(poi.getLatitude());
        addr.setLongitude(poi.getLongitude());
        String addressLine;

        if (poi.getAddress() != null) {
            if (!poi.getAddress().contains(poi.getName())) {
                addressLine = (poi.getName() + ", " + poi.getAddress());
            } else {
                addressLine = poi.getAddress();
            }
        } else {
            addressLine = poi.getName();
        }
        addr.setAddressLine(addr.getMaxAddressLineIndex() + 1, addressLine);
        addresses.add(addr);
    }

    return addresses;
}