Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Language Question: ? extends node

 
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!
 
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,
 
Marshal
Posts: 70304
283
  • 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
Marshal
Posts: 70304
283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
I can't renounce my name. It's on all my stationery! And hinted in this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic