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.ProfileSelfieManualCropActivity.java

private DataForAutoRegistration parseCarddata(String cardResponse) {
    Gson gson = new Gson();
    try {/* ww  w.  j  ava  2s  .  co m*/
        Type listType = new TypeToken<List<CardResponse>>() {
        }.getType();
        List<CardResponse> cardResponses = (List<CardResponse>) gson.fromJson(cardResponse, listType);
        ArrayList<CardResponse> cardResponseList = (ArrayList) cardResponses;
        Log.v(TAG, cardResponseList.toString());

        CardResponse cardRes = null;
        if (cardResponseList.size() > 0) {
            cardRes = cardResponseList.get(0);
        }
        CardResponse cardRes2 = null;
        if (cardResponseList.size() > 1) {
            cardRes2 = cardResponseList.get(1);
        }

        Log.v(TAG, "CardResponse Data:as obj:" + cardRes.toString());
        return createUpdateCardResponse(cardRes, cardRes2);
    } catch (Exception e) {

        return null;

    }

}

From source file:org.hfoss.posit.android.web.Communicator.java

public boolean sendFind(Find find, String action) {
    boolean success = false;
    String url;//from  ww w.  j  a  va  2 s. c  o m
    HashMap<String, String> sendMap = find.getContentMapGuid();
    // Log.i(TAG, "sendFind map = " + sendMap.toString());
    cleanupOnSend(sendMap);
    sendMap.put("imei", imei);
    String guid = sendMap.get(PositDbHelper.FINDS_GUID);
    long id = find.getId();
    // Create the url

    if (action.equals("create")) {
        url = server + "/api/createFind?authKey=" + authKey;
    } else {
        url = server + "/api/updateFind?authKey=" + authKey;
    }
    if (Utils.debug) {
        Log.i(TAG, "SendFind=" + sendMap.toString());
    }

    // Send the find
    try {
        responseString = doHTTPPost(url, sendMap);
    } catch (Exception e) {
        Log.i(TAG, e.getMessage());
        Utils.showToast(mContext, e.getMessage());
        return false;
    }
    if (Utils.debug)
        Log.i(TAG, "sendFind.ResponseString: " + responseString);

    // If the update failed return false
    if (responseString.indexOf("True") == -1) {
        Log.i(TAG, "sendFind result doesn't contain 'True'");
        return false;
    } else {
        PositDbHelper dbh = new PositDbHelper(mContext);
        success = dbh.markFindSynced(id);
        if (Utils.debug)
            Log.i(TAG, "sendfind synced " + id + " " + success);
    }

    if (success) {
        // Otherwise send the Find's images

        //long id = Long.parseLong(sendMap.get(PositDbHelper.FINDS_ID));
        PositDbHelper dbh = new PositDbHelper(mContext);
        ArrayList<ContentValues> photosList = dbh.getImagesListSinceUpdate(id, projectId);

        Log.i(TAG, "sendFind, photosList=" + photosList.toString());

        Iterator<ContentValues> it = photosList.listIterator();
        while (it.hasNext()) {
            ContentValues imageData = it.next();
            Uri uri = Uri.parse(imageData.getAsString(PositDbHelper.PHOTOS_IMAGE_URI));
            String base64Data = convertUriToBase64(uri);
            uri = Uri.parse(imageData.getAsString(PositDbHelper.PHOTOS_THUMBNAIL_URI));
            String base64Thumbnail = convertUriToBase64(uri);
            sendMap = new HashMap<String, String>();
            sendMap.put(COLUMN_IMEI, Utils.getIMEI(mContext));
            sendMap.put(PositDbHelper.FINDS_GUID, guid);

            sendMap.put(PositDbHelper.PHOTOS_IDENTIFIER,
                    imageData.getAsString(PositDbHelper.PHOTOS_IDENTIFIER));
            sendMap.put(PositDbHelper.FINDS_PROJECT_ID, imageData.getAsString(PositDbHelper.FINDS_PROJECT_ID));
            sendMap.put(PositDbHelper.FINDS_TIME, imageData.getAsString(PositDbHelper.FINDS_TIME));
            sendMap.put(PositDbHelper.PHOTOS_MIME_TYPE, imageData.getAsString(PositDbHelper.PHOTOS_MIME_TYPE));

            sendMap.put("mime_type", "image/jpeg");

            sendMap.put(PositDbHelper.PHOTOS_DATA_FULL, base64Data);
            sendMap.put(PositDbHelper.PHOTOS_DATA_THUMBNAIL, base64Thumbnail);
            sendMedia(sendMap);
        }
    }
    // Update the Synced attribute.
    return success;
}

From source file:org.clever.HostManager.HyperVisorPlugins.Libvirt.pollEventThread.java

private void updateMap() {
    try {/*from www.java  2s .  co  m*/
        ArrayList listCl = new ArrayList(idVMWrapper.keySet());
        ArrayList listLib = new ArrayList(listHVms());
        logger.debug("Output listHVMs: " + listLib.toString());
        if (listCl.isEmpty()) {
            for (Object id1 : listLib) {
                String id = (String) id1;
                logger.info("VM adding: " + id);
                VMWrapper wrap = createVMwrapper(id);
                idVMWrapper.put(id, wrap);
                logger.info("VM added: " + id);
            }
            return;
        } else {
            for (Object id1 : listLib) {

                boolean a = false;
                for (Object id2 : listCl) {
                    if (id1.equals(id2)) {
                        a = true;
                        break;
                    }
                }
                if (a == false) {
                    String id = id1.toString();
                    VMWrapper wrap = createVMwrapper(id);
                    idVMWrapper.put(id, wrap);
                }
            }
        }

    } catch (CleverException ex) {
        logger.error("Error on updateMap: " + ex.getMessage());
    }
}

From source file:edu.si.services.sidora.rest.mci.MCIServiceTest.java

@Test
public void testWorkbenchLoginSetCookie() throws Exception {
    ArrayList<String> testCookie = new ArrayList<>();
    testCookie.add(String.valueOf(UUID.randomUUID()) + "=" + String.valueOf(UUID.randomUUID()) + ";");
    testCookie.add(String.valueOf(UUID.randomUUID()) + "=" + String.valueOf(UUID.randomUUID()));

    MockEndpoint mockResult = getMockEndpoint("mock:result");
    mockResult.expectedMessageCount(1);/*from  ww  w .j ava2  s.  co  m*/
    mockResult.expectedHeaderReceived("Cookie", testCookie.toString().replaceAll("[\\[,\\]]", ""));
    mockResult.setAssertPeriod(1500);

    context.getRouteDefinition("MCIWorkbenchLogin").adviceWith(context, new AdviceWithRouteBuilder() {
        @Override
        public void configure() throws Exception {
            weaveById("workbenchLogin").replace().setHeader(Exchange.HTTP_RESPONSE_CODE).simple("302");
            weaveById("workbenchLoginCreateResearchProjectCall").replace().to("mock:result");
        }
    });

    Exchange exchange = new DefaultExchange(context);
    exchange.getIn().setBody("test body");
    exchange.getIn().setHeader("Set-Cookie", testCookie);

    template.send("direct:workbenchLogin", exchange);

    assertMockEndpointsSatisfied();
}

From source file:org.sakaiproject.evaluation.tool.reporting.EvalPDFReportBuilder.java

private void addBigElementArray(ArrayList<Element> myElements) {
    //20140226 - daniel.merino@unavarra.es - https://jira.sakaiproject.org/browse/EVALSYS-1100
    //Adds an array of elements that does not fit in a column, one by one.
    //Current lowagie library does not allow to copy a List if it exceeds a whole page. It is truncated.
    //So we add Lists always one element at a time.
    LOG.debug(//from w  w w.  j av  a 2s  .co  m
            "Entering in AddBigElementArray with: " + myElements.toString() + ". Curent column is: " + column);

    responseArea.setText(null);
    LOG.debug("Initial vertical position: " + responseArea.getYLine());

    for (Element element : myElements) {
        if (element.getClass().equals(com.lowagie.text.List.class)) {
            LOG.debug("We have a List element to add.");
            com.lowagie.text.List myList = (com.lowagie.text.List) element;
            for (int i = 0; i < myList.size(); i++) {
                ArrayList<ListItem> arrayItems = myList.getItems();
                ListItem miItem = arrayItems.get(i);
                String text = (String) miItem.getContent();
                Paragraph para = new Paragraph("\u2022   " + text, paragraphFont);
                para.setIndentationLeft(20f);
                this.addLittleElementWithJump(para);
            }
        } else {
            addLittleElementWithJump(element);
        }
    }

}

From source file:com.krayzk9s.imgurholo.ui.ImagesFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.d("requestcode", requestCode + "");
    if (data.getExtras() == null)
        return;/*w  w w . j a  va  2 s .co m*/
    Object bundle = data.getExtras().get("data");
    Log.d("HELO", bundle.getClass().toString());
    switch (requestCode) {
    case 1:
        super.onActivityResult(requestCode, resultCode, data);
        ArrayList<String> imageIds = data.getStringArrayListExtra("data");
        if (imageIds != null)
            Log.d("Ids!", imageIds.toString());
        AddImagesToAlbumAsync imageAsync = new AddImagesToAlbumAsync(imageIds,
                ((ImgurHoloActivity) getActivity()).getApiCall(), albumId);
        imageAsync.execute();
        break;
    }
}

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

private DataForAutoRegistration parseCarddata(String cardResponse) {
    Gson gson = new Gson();
    try {//from   w  ww  .  j av  a  2  s. c  o m
        Type listType = new TypeToken<List<CardResponse>>() {
        }.getType();
        List<CardResponse> cardResponses = (List<CardResponse>) gson.fromJson(cardResponse, listType);
        ArrayList<CardResponse> cardResponseList = (ArrayList) cardResponses;
        Log.v(TAG, cardResponseList.toString());

        CardResponse cardRes = cardResponseList.get(0);
        CardResponse cardRes2 = cardResponseList.get(1);

        Log.v(TAG, "CardResponse Data:as obj:" + cardRes.toString());
        return createUpdateCardResponse(cardRes, cardRes2);
    } catch (Exception e) {

        return null;

    }

}

From source file:org.apache.solr.servlet.SolrRequestParserTest.java

License:asdf

@Test
public void testStreamBody() throws Exception {
    String body1 = "AMANAPLANPANAMA";
    String body2 = "qwertasdfgzxcvb";
    String body3 = "1234567890";

    SolrCore core = h.getCore();/*from  w  w  w  .  j  ava  2s  . co  m*/

    Map<String, String[]> args = new HashMap<>();
    args.put(CommonParams.STREAM_BODY, new String[] { body1 });

    // Make sure it got a single stream in and out ok
    List<ContentStream> streams = new ArrayList<>();
    SolrQueryRequest req = parser.buildRequestFrom(core, new MultiMapSolrParams(args), streams);
    assertEquals(1, streams.size());
    assertEquals(body1, IOUtils.toString(streams.get(0).getReader()));
    req.close();

    // Now add three and make sure they come out ok
    streams = new ArrayList<>();
    args.put(CommonParams.STREAM_BODY, new String[] { body1, body2, body3 });
    req = parser.buildRequestFrom(core, new MultiMapSolrParams(args), streams);
    assertEquals(3, streams.size());
    ArrayList<String> input = new ArrayList<>();
    ArrayList<String> output = new ArrayList<>();
    input.add(body1);
    input.add(body2);
    input.add(body3);
    output.add(IOUtils.toString(streams.get(0).getReader()));
    output.add(IOUtils.toString(streams.get(1).getReader()));
    output.add(IOUtils.toString(streams.get(2).getReader()));
    // sort them so the output is consistent
    Collections.sort(input);
    Collections.sort(output);
    assertEquals(input.toString(), output.toString());
    req.close();

    // set the contentType and make sure tat gets set
    String ctype = "text/xxx";
    streams = new ArrayList<>();
    args.put(CommonParams.STREAM_CONTENTTYPE, new String[] { ctype });
    req = parser.buildRequestFrom(core, new MultiMapSolrParams(args), streams);
    for (ContentStream s : streams) {
        assertEquals(ctype, s.getContentType());
    }
    req.close();
}

From source file:com.taobao.weex.devtools.json.ObjectMapperTest.java

@Test
public void testObjectToPrimitive() throws JSONException {
    ArrayOfPrimitivesContainer container = new ArrayOfPrimitivesContainer();
    ArrayList<Object> primitives = container.primitives;
    primitives.add(Long.MIN_VALUE);
    primitives.add(Long.MAX_VALUE);
    primitives.add(Integer.MIN_VALUE);
    primitives.add(Integer.MAX_VALUE);
    primitives.add(Float.MIN_VALUE);
    primitives.add(Float.MAX_VALUE);
    primitives.add(Double.MIN_VALUE);
    primitives.add(Double.MAX_VALUE);

    String json = mObjectMapper.convertValue(container, JSONObject.class).toString();
    JSONObject obj = new JSONObject(json);
    JSONArray array = obj.getJSONArray("primitives");
    ArrayList<Object> actual = new ArrayList<>();
    for (int i = 0, N = array.length(); i < N; i++) {
        actual.add(array.get(i));/* w  w  w.j  a va 2s .co m*/
    }
    assertEquals(primitives.toString(), actual.toString());
}