ArrayStoreException occurs when an attempt to save an object with the wrong type is placed in an array.
What does the code do?
In the above code example, the method CollectionUtil.transformaccepts Collectionand performs the conversion of elements in place, which means that they Objectare extracted from the source Collection(for example List) and placed back into the same one Collection.
Transformer String Integer - - - , .
?
, CollectionUtil.transform Transformer Collection Collection, strList.
, List, Arrays.asList, String[], ArrayStoreException. , String[5]. ( Eclipse, JRE 6 Windows.)
?
, , , , , . ( Apache Commons Collection ), .
- List - List String s, Transformer.transform String.
?
Google Collections2.transform, Collection a Collection, Function.
generics, typeafe, , Collection, , .