I have a list of forms, which are kept in an array list (example values: F1, F2, ..., F7), and a list of user ids (example values: 1,2, 3). I need to have a table which contains user id and a list of forms such as Hashtable, where integer value is a user id (f.ex. 1) and ArrayList is a list of forms this user can access (f.ex. for user 1 they are F2, F3). How can I create this hashtable so that arraylist for every matched user id contains the values from the list of forms?
How about
Map<Integer,List<String>> yourList = new HashMap<Integer,List<String>>();
That pretty much fits your requirement - the Integer
is your user ID and the List<String>
can hold the allowed forms for that user.
Also: Ditto @Tichodroma's comment!
Cheers,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.