Example usage for java.util ArrayList toString

List of usage examples for java.util ArrayList toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.hackensack.umc.activity.ViewProfileActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_profile);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    sharedPreferences = getSharedPreferences(Constant.SHAREPREF_TAG, MODE_PRIVATE);
    insuranceInfoTv = (TextView) findViewById(R.id.prof_insurance_tv);
    if (Util.isUserLogin(this) && Util.isPatientIdValid(this)) {

        try {/*from  ww  w  .j av  a  2 s.  com*/
            mPatient = new LoginUserData(new JSONObject(Util.getPatientJSON(this)));
            ((TextView) findViewById(R.id.profile_fname)).setText(mPatient.getFirstName());
            ((TextView) findViewById(R.id.prof_lname)).setText(mPatient.getLastName());
            ((TextView) findViewById(R.id.prof_license)).setText(
                    TextUtils.isEmpty(mPatient.getDrivingLicense()) ? "-" : mPatient.getDrivingLicense());
            DateFormat formatterDate = new SimpleDateFormat("MM-dd-yyyy");

            Date d = null;
            try {
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
                d = sdf.parse(mPatient.getBirthDate());
            } catch (Exception e) {
                Log.e("Date", " " + e);
            }

            //Bug is there : Null Pointer : Appointment Date
            ((TextView) findViewById(R.id.prof_date)).setText(formatterDate.format(d.getTime()));
            ((TextView) findViewById(R.id.prof_gender_tv)).setText(mPatient.getGender());
            //Code for getting and displaying phone numbers
            ArrayList<Telecom> telecom = mPatient.getTelephone();
            Log.v("Telecom", telecom.toString());
            String phonestr = null;
            for (int i = 0; i < telecom.size(); i++) {
                if (((Telecom) telecom.get(i)).getSystem().equalsIgnoreCase(Telecom.TELECOM_EMAIL)) {
                    ((TextView) findViewById(R.id.prof_email)).setText(((Telecom) telecom.get(i)).getValue());
                } else if (((Telecom) telecom.get(i)).getSystem().equalsIgnoreCase(Telecom.TELECOM_PHONE)) {
                    phonestr = telecom.get(i).getValue();
                    final Editable doctorPhoneNum = new SpannableStringBuilder(phonestr);
                    PhoneNumberUtils.formatNumber(doctorPhoneNum,
                            PhoneNumberUtils.getFormatTypeForLocale(Locale.US));
                    if (((Telecom) telecom.get(i)).getUse().equalsIgnoreCase(Telecom.TELECOM_MOBILE_PHONE)) {
                        findViewById(R.id.mobile_ll).setVisibility(View.VISIBLE);
                        ((TextView) findViewById(R.id.prof_mob_num)).setText(doctorPhoneNum);

                    } else if (((Telecom) telecom.get(i)).getUse()
                            .equalsIgnoreCase(Telecom.TELECOM_HOME_PHONE)) {
                        findViewById(R.id.home_ll).setVisibility(View.VISIBLE);
                        ((TextView) findViewById(R.id.prof_home_num)).setText(doctorPhoneNum);

                    } else if (((Telecom) telecom.get(i)).getUse()
                            .equalsIgnoreCase(Telecom.TELECOM_WORK_PHONE)) {
                        findViewById(R.id.work_ll).setVisibility(View.VISIBLE);
                        ((TextView) findViewById(R.id.prof_work_num)).setText(doctorPhoneNum);
                    }
                }
            }
            //Code to get and display address
            if (mPatient.getAddress() != null && mPatient.getAddress().size() > 0) {
                Address address = ((ArrayList<Address>) mPatient.getAddress()).get(0);
                ((TextView) findViewById(R.id.prof_addr_tv)).setText(address.getStreet1() + ","
                        + (TextUtils.isEmpty(address.getStreet2()) ? "" : address.getStreet2() + ",")
                        + address.getCity() + "," + address.getState() + "," + address.getZip() + ","
                        + address.getCountry());
            }

        } catch (Exception e) {
            Log.e("isUserLogin", "", e);

        }
        //Code to get and display insurance info

        new GetInsuranceInfo().execute(mPatient.getMRNId());
    }

    /* mProgressDialog = new ProgressDialog(this);
     mProgressDialog.setCancelable(false);*/
}

From source file:nl.hnogames.domoticz.Fragments.Scenes.java

private void processScenes() {
    if (listView != null) {
        //switch toggled, refresh listview
        state = listView.onSaveInstanceState();
        WidgetUtils.RefreshWidgets(mContext);
    }//from  w w w  . j a  v  a 2  s.  c  om

    mDomoticz.getScenes(new ScenesReceiver() {

        @Override
        public void onReceiveScenes(ArrayList<SceneInfo> scenes) {
            successHandling(scenes.toString(), false);
            createListView(scenes);
        }

        @Override
        public void onError(Exception error) {
            errorHandling(error);
        }
    });
}

From source file:nl.hnogames.domoticz.Fragments.Utilities.java

private void processUtilities() {
    final UtilityClickListener listener = this;
    mDomoticz.getUtilities(new UtilitiesReceiver() {

        @Override//  w  ww  .  j  a  va  2s.com
        public void onReceiveUtilities(ArrayList<UtilitiesInfo> mUtilitiesInfos) {
            successHandling(mUtilitiesInfos.toString(), false);

            Utilities.this.mUtilitiesInfos = mUtilitiesInfos;
            adapter = new UtilityAdapter(mContext, mUtilitiesInfos, listener);

            createListView();
            hideProgressDialog();
        }

        @Override
        public void onError(Exception error) {
            errorHandling(error);
        }
    });
}

From source file:nl.hnogames.domoticz.Fragments.Utilities.java

@Override
public void onLogClick(final UtilitiesInfo utility, final String range) {
    showProgressDialog();/*from   w  w w . j a v a2  s. c  o  m*/
    final String graphType = utility.getSubType().replace("kWh", "counter").replace("Energy", "counter");

    mDomoticz.getGraphData(utility.getIdx(), range, graphType, new GraphDataReceiver() {
        @Override
        public void onReceive(ArrayList<GraphPointInfo> mGraphList) {
            Log.i("GRAPH", mGraphList.toString());
            hideProgressDialog();
            GraphDialog infoDialog = new GraphDialog(getActivity(), mGraphList, R.layout.dialog_graph);
            infoDialog.setRange(range);
            infoDialog.setSteps(4);
            infoDialog.setTitle(graphType.toUpperCase());
            infoDialog.show();
        }

        @Override
        public void onError(Exception error) {
            Snackbar.make(coordinatorLayout,
                    getActivity().getString(R.string.error_log) + ": " + utility.getName() + " " + graphType,
                    Snackbar.LENGTH_SHORT).show();
            hideProgressDialog();
        }
    });
}

From source file:org.renjin.sexp.ComplexArrayVector.java

@Override
public String toString() {
    ArrayList<String> list = new ArrayList<String>();
    for (Complex z : values) {
        list.add(z.getReal() + "+" + z.getImaginary() + "i");
    }// ww  w.ja v  a  2s .  c o  m
    return list.toString();
}

From source file:com.github.lynxdb.server.api.http.handlers.EpVhost.java

@RequestMapping(value = "", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity createVhost(Authentication _authentication, @RequestBody @Valid VhostCreationRequest _vcr,
        BindingResult _bindingResult) {// ww w . j  a v  a  2 s.  c o m

    if (_bindingResult.hasErrors()) {
        ArrayList<String> errors = new ArrayList();
        _bindingResult.getFieldErrors().forEach((FieldError t) -> {
            errors.add(t.getField() + ": " + t.getDefaultMessage());
        });
        return new ErrorResponse(mapper, HttpStatus.BAD_REQUEST, errors.toString()).response();
    }

    Vhost v = new Vhost(_vcr);

    vhosts.save(v);

    return ResponseEntity.ok(v);
}

From source file:com.xwiki.authentication.sts.STSTokenValidator.java

/**
 * getClaims(org.opensaml.saml1.core.Assertion samlAssertion)
 * Get's List of STSClaims according to samlAssertion
 * @param samlAssertion org.opensaml.saml1.core.Assertion
 * @return ArrayList<STSClaim> (Claims-based identity is a common way for applications to acquire the identity information they need about users inside their organization)
 * @throws SecurityException, ValidationException, ConfigurationException, UnmarshallingException, CertificateException, KeyException
 * @throws UnmarshallingException, ValidationException, CertificateExceptio @throws UnmarshallingException, ValidationException, CertificateException n 
 *//*from   w w w .ja  v a2s.c  o m*/
private static List<STSClaim> getClaims(org.opensaml.saml1.core.Assertion samlAssertion)
        throws SecurityException, ValidationException, ConfigurationException, UnmarshallingException,
        CertificateException, KeyException {

    ArrayList<STSClaim> claims = new ArrayList<STSClaim>();

    List<org.opensaml.saml1.core.AttributeStatement> attributeStmts = samlAssertion.getAttributeStatements();

    for (org.opensaml.saml1.core.AttributeStatement attributeStmt : attributeStmts) {
        List<org.opensaml.saml1.core.Attribute> attributes = attributeStmt.getAttributes();

        for (org.opensaml.saml1.core.Attribute attribute : attributes) {
            String claimType = attribute.getAttributeNamespace() + "/" + attribute.getAttributeName();
            String claimValue = getValueFrom(attribute.getAttributeValues());
            claims.add(new STSClaim(claimType, claimValue));
        }
    }
    log.trace("Claims: " + claims.toString());
    return claims;
}

From source file:com.github.lynxdb.server.api.http.handlers.EpSuggest.java

@RequestMapping(path = "", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity post(@RequestBody @Valid SuggestRequest _request, Authentication _authentication,
        BindingResult _bindingResult) {/*from ww w  .  jav  a 2 s . c o  m*/

    if (_bindingResult.hasErrors()) {
        ArrayList<String> errors = new ArrayList();
        _bindingResult.getFieldErrors().forEach((FieldError t) -> {
            errors.add(t.getField() + ": " + t.getDefaultMessage());
        });
        return new ErrorResponse(mapper, HttpStatus.BAD_REQUEST, errors.toString(), null).response();
    }

    return response(_request, _authentication);
}

From source file:eu.cassandra.utils.Utils.java

public static double estimateThreshold(double[] power, boolean median) {
    double result = 0;

    ArrayList<Double> minimums = new ArrayList<Double>();
    double min = Double.POSITIVE_INFINITY;

    for (int i = 0; i < power.length; i++) {

        if (min > power[i])
            min = power[i];/*  w  w  w  .  j  av  a 2  s.  c  o  m*/

        if (i % 1440 == 0 && i != 0) {
            minimums.add(min);
            min = Double.POSITIVE_INFINITY;
        }

    }

    if (minimums.size() == 0)
        minimums.add(min);

    log.debug("================THRESHOLD SETTING================");
    log.debug("Minimums: " + minimums.toString());
    log.debug("Median:" + median);

    if (median)
        result = Utils.estimateMedian(minimums);
    else
        result = Utils.estimateMean(minimums);

    log.debug("Resulting threshold: " + result);
    log.debug("");
    log.debug("");

    return result;
}

From source file:org.venice.piazza.servicecontroller.messaging.handlers.UpdateServiceHandlerTest.java

/**
 * Test that handle returns a valid value
 *///from ww w.  j  a va 2  s  .co m
@Test
public void testValidUpdate() {
    UpdateServiceJob job = new UpdateServiceJob();
    job.data = service;
    job.jobId = "a842aae2-bd74-4c4b-9a65-c45e8cd9060";

    ArrayList<String> resultList = new ArrayList<String>();
    resultList.add(job.jobId);
    resultList.add(service.getServiceId());

    ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultList.toString(), HttpStatus.OK);

    final UpdateServiceHandler ushMock = Mockito.spy(usHandler);

    Mockito.doReturn("success").when(ushMock).handle(service);

    ResponseEntity<String> result = ushMock.handle(job);

    assertEquals("The response entity was correct for the update", responseEntity, result);

}