This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Language Question: ? extends node

 
Eric Fancis
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the following code called?



I do not know what to Google for information on the topic.
I do not know what the code is doing (Mainly the <? extends node>, but I also do not know what Comaparable<IProcessor> is doing either).

So, if I could get some direction on what to Google for, I will come back with more specific questions.

Thanks!
 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Tough question :-)
Well is an interface (with generics) that explicit a contract and decouples the object that fullfills the contract from the object that uses the contract.

With Comparable<IProcessor> you force that the class that implements IProcessor have to implement
and IProcessorMatcher<? extends Node> means that the IProcessorMatcher could be typed with any class that extends Node.


Cheers,
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go to the Java Tutorials and use ctrl‑-F-generics. You will find at least two sections, and one of them will tell you about <? extends Foo>
 
Eric Fancis
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perfect. Thank you guys!

Thanks,
Eric
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic