vendredi 16 mars 2018

how to use ToStringBuilder.reflectionToString to get contents of arrayList

I want to get contents of arrayList using reflection, but I am only getting the arrayList object instead of arrayList values with reflectionToString. Below is the sample code and output:

   ArrayList<String> nodeList = new ArrayList<String>();
   nodeList.add("Inpt1");
   nodeList.add("Inpt2");
   System.out.println(ToStringBuilder.reflectionToString(nodeList,  ToStringStyle.MULTI_LINE_STYLE));

   Output:
   java.util.ArrayList@5ca881b5[
   size=2
   ]

Can you tell me a way to get the contents of ArrayList with reflectionToString?





Aucun commentaire:

Enregistrer un commentaire