problemSuppose there are arrays
Element[]Array= {New Element(1),New Element(2),New Element(3)};
How do you convert it to arraylist<element> ArrayList?
Essence Answer
arrays asList array Arrays.aslist(new Element (1), new Element (2), new Element (3))
However, there are some pits to be aware of:1. The list to be generated is fixed length. In other words, if you do add or remove to it, it will throw unsupportedoperationexception. 2, if you modify the value of the array, the corresponding value in the list will also change!
If you want to avoid these two pits, use this method instead
Collections.AddAll(ArrayList,Array);
StackOverflow:Http://stackoverflow.com/questions/157944/how-to-create-arraylist-arraylistt-from-array-t
Column Introduction:
very like StackOverflow, can always find a solution to the problem of incurable diseases. Accidentally found that the site has a list of heat. So select some of the more hot questions, read all the answers to each question, and then sort them out in your own understanding. I hope that the discussion above will be presented to you in a more streamlined and appropriate way.
if you want to reprint, please specify the original address
Http://blog.csdn.net/lizeyang
"StackOverflow Good question" Converts an array to a list