Join date: May 14, 2022


E-sword V9.9.1 Along With 75 Ver




Q: How to get child table from list of ids and convert into child object? Suppose I have the following object: public class Parent { private String id; private String name; private Set children; } public class Child { where a Child has an id and a name. Now, how can I write a method that takes a Set (where an Integer is the id of a Child) as an argument and returns the corresponding Child object? I've managed to write the following method, but I'm not sure if it's the most elegant approach. Is there a more elegant way? public static Child getChildByIDs(Set ids) { List children = new ArrayList(); for (Integer id : ids) { Child child = new Child(); child.setId(id); child.setName("child name"); children.add(child); } return children.get(0); A: Your code is OK and indeed the best way to do this. If you want to be more efficient (and you will never be because it's a small operation) then you could create a List instead of a Set. This will prevent the need to iterate through the Set again. children.add(new Child(id)); If you are planning to use the objects outside of the class then you could avoid instantiating a Child for every id by using a Map. Map children = new HashMap(); for (Integer id : ids





AKVIS MakeUp 4 (Full Crack)

ar media plugin 2.2 crack 1

Musafir 1 720p Download Movies

IObit Software Updater Pro With Crack (Latest)

© 2023 by Name of Site. Created on Editor X.


E-sword V9.9.1 Along With 75 Ver

More actions