Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generics Question

 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

whats wrong with this? The compiler complains that it cannot instantiate the type ArrayList<? extends someAbstractClass>
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot use wildcards in constructor calls. Use

new ArrayList<someAbstractClass>()

instead.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic