java - generic array with wildcard cause error -



java - generic array with wildcard cause error -

i wanted create jcombobox´s type string, having in array, used wildcard array , string single elements:

jcombobox<?>[] combos=new jcombobox<?>[10]; ... combos[i]=new jcombobox<string>();

same defaultcomboboxmodels:

defaultcomboboxmodel<?>[] combomodels=new defaultcomboboxmodel<?>[10]; ... combomodels[i]=new defaultcomboboxmodel<string>();

assigning them each other:

... combos[i].setmodel(combomodels[i]);

now gives compiler error (capture#13-of ? not applicable capture#14-of ?). have expected single elements set string , everything´s fine. what´s about, how deal it? (except of doing raw)

java needs ensure, model , combo of same type. on given example, 1 time types gone after erasure, there no way this. set model<integer> combo<string> such way.

java arrays generics

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -