2011-12-20 54 views

回答

4
field.set(myBean, Collections.singletonList("myvalue")); // for one element list 

// if list already exists and you just want to append your value 
List<String> theList = (List<String>)field.get(myBean); 
list.add("myvalue"); 
4
List<String> list = (List<String>)Field.get(myBean); 
list.add(value); 
+0

謝謝,有用的答覆,但@AlexR只是說明它更好一點。 – Rahul 2011-12-20 09:54:20

+0

也快一點,所以沒問題:P – bezmax 2011-12-20 09:55:16

相關問題