• Post Reply Bookmark Topic Watch Topic
  • New Topic

Type inference and Collectors.toList

 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys!

I started playing with Java8 and I encountered one interesting issue. Please look at the following code:



It compiles without any problem.

Now, let's consider that:



and the result is:



What is the reason for that?

I also tried:



but it gave me nothing.
 
Stephan van Hulst
Bartender
Posts: 6583
84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you were a computer, how would you infer the type of the following piece of code?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!