Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Language Question: ? extends node

 
Eric Fancis
Greenhorn
Posts: 29
  • 0
  • 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
  • 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
Pie
Posts: 47216
52
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perfect. Thank you guys!

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