I am having difficulty with this conversion. I do not know if there is a syntax error, or is it even impossible.
I need to convert from -
private static final List<Contact> CONTACTS = Arrays.asList(
new Contact("text1", "name1"),
new Contact("text2", "name2"),
new Contact("text3", "name3"));
To -
Collection c = new ArrayList(Arrays.asList(--?--))
-? - → (I do not understand what is happening here)
Thus, I intend to avoid an UnsupportedOperationException. Any help appreciated, thanks!
Hi everyone, I get it! It worked -
Solution:
List<? extends Contact> col = new ArrayList<Contact>(CONTACTS);
source
share