• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Confused on method signature collect in Stream inteface

 
Ranch Hand
Posts: 166
1
jQuery Eclipse IDE
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 28372
99
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 166
1
jQuery Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Paul, will look into the API deeply.
 
Bartender
Posts: 15737
368
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 166
1
jQuery Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Climb the rope! CLIMB THE ROPE! You too tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic