Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Confused on method signature collect in Stream inteface

 
Ranch Hand
Posts: 161
1
jQuery Eclipse IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

In Stream interface, the definition is as Stream<T> and the collec method is defined as:



What does R, A mean, how to interpret. I am facing difficulty in understanding the method definitions.

Thanks & Regards,

Swapna.
 
Marshal
Posts: 25682
69
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought that was an interesting question so I went to look at the API documentation for the Stream interface. And the method you asked about uses a Collector object, so finding out about Collector seemed like a good idea.

And when I clicked on the link I found that the documentation for Collector started out at the top with a description of those three type parameters. Did you find that?

(By the way, you posted this in one of the certification forums. Was that related to a particular certification exam? If not, let us know and a moderator will move it to a more suitable forum.)
Staff note (Paul Clapham):

I moved the thread to the "Lambdas and Streams" forum.

 
Swapna latha
Ranch Hand
Posts: 161
1
jQuery Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul, will look into the API deeply.
 
Saloon Keeper
Posts: 12154
258
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On a tangent: In general you don't need to worry about the A parameter. You only need to care about it if you implement your own Collector.
 
Swapna latha
Ranch Hand
Posts: 161
1
jQuery Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:On a tangent: In general you don't need to worry about the A parameter. You only need to care about it if you implement your own Collector.


Thank you Stephan.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic