Posts

Showing posts with the label List

[JAVA] Merge two lists in Java

Image
List<String> listA = new ArrayList<>(); list1.add("a1"); list1.add("a2"); List<String> listB = new ArrayList<>(); list2.add("b1"); list2.add("b2"); List<String> joinedAB = new ArrayList<>(); joinedAB.addAll(listA); joinedAB.addAll(listB); System.out.println(joinedAB); // result !! [a1, a2, b1, b2]  😀 Thank you!!

[JAVA] Adding the VO list received from the DB

Image
// add list List<GetVO> addInfo = new ArrayList<GetVO>();  // list get from DB List<GetVO> GetInfo = service.getInfo(GetVO); for(int h=0; h<GetInfo.size(); h++) { addInfo.add((GetVO) GetInfo.get(h)); } It is used because a little manipulation is required to extract three different numbers of data result values ​​into one Excel screen. 😀 Thank you!!