java - Add String Values from a for loop to list -
this question has answer here:
- how make new list in java 21 answers
public static void printfiles(nodelist node) { (int = 0; < node.getlength(); i++) { node file = node.item(i); string nodevalue = file.getattributes().getnameditem("urlname").getnodevalue(); system.out.println(nodevalue); } } output: 0a4f171c-e0a4-4aa8-b43b-3989c235ff58.txt 0ccfa1a4-16b0-4e1f-abc9-e17907bb591f.txt 17c0545b-377e-4e0a-bb45-29f38fc91533.txt 3b341bf0-2cd7-46fe-a834-5b67804e5ff1.txt 48121209-d58e-4565-83b7-05062799be6e.txt 511b7a89-e4de-4f6e-9c8f-5ba65f675d7b.txt compress.txt dadadada.txt e0c44cb9-2b1c-444c-a429-64531ea6a9a0.txt e68b1d1d-9a66-4678-a6c1-76c64ae8be08.txt hgafgahfka.txt jdjajhdajdajd.txt test1.txt test2.txt
i parsed xml document , got values through loop alues need in single place list can pass other function.can 1 please let me know how add in list .below code , current output.
string input = "hello world"; list<string> list = new arraylist<>(); list.add(input); system.out.println(list.get(0)); > hello world
good luck
Comments
Post a Comment