State of the Lambda #4 (
http://cr.openjdk.java.net/~briangoetz/lambda/lambda-state-4.html) says you 
can do:

ClassName::staticMethod
or
instanceName::instanceMethod

On Friday, November 2, 2012 5:50:37 PM UTC-5, Ricky Clarkson wrote:
>
> I can't confirm right now but I'm pretty sure I've done 
> ClassName::methodName in my experiments with FunctionalJava and Java 8.  
> Doesn't the State of the Lambda cover that too?
> On Nov 2, 2012 6:54 PM, "clay" <clayt...@gmail.com <javascript:>> wrote:
>
>> AFAIK,
>>
>> You can't do ClassName::instanceMethod()
>> You have to do classInstance::instanceMethod()
>>
>> So, even if getAddressOption() was an instance method, you would have to 
>> do onePersonInstance::getAddressOption, and the method reference is bound 
>> to that one instance which wouldn't fit with the example.
>>
>> On Friday, November 2, 2012 4:33:14 PM UTC-5, Ricky Clarkson wrote:
>>>
>>> It's rare that you actually expose public fields in Java, so let's 
>>> assume addressOption and friends are methods, and then the method 
>>> reference syntax works fine. 
>>>
>>> Also, I said 'with proper support', regarding the returned collection 
>>> type. :)  But sure, adding a .into wouldn't be too bad. 
>>>
>>> On Fri, Nov 2, 2012 at 6:09 PM, clay <clayt...@gmail.com> wrote: 
>>> > First, you can't use the :: method reference syntax with a variable. 
>>> > 
>>> > Secondly, the map and flatMap functions currently exist on the Stream 
>>> > interface and return a modified Stream. So you have to start with 
>>> > people.stream() and end with either a Stream instance or call 
>>> > .into(someCollection) to put them into a collection. 
>>> > 
>>> > 
>>> > On Friday, November 2, 2012 3:29:25 PM UTC-5, Ricky Clarkson wrote: 
>>> >> 
>>> >> With proper support it would be: 
>>> >> 
>>> >> List<String> zips2 = 
>>> >> people.flatMap(Person::**addressOption).flatMap(**Address:zipOption); 
>>>
>>> >> 
>>> >> That might take a stubborn person a couple of minutes to understand 
>>> >> but after that even the most determined anti-flatmapper will be able 
>>> >> to curse, rewrite, fire the writer of but ultimately understand code 
>>> >> like this without any real trouble. 
>>> >> 
>>> >> On Fri, Nov 2, 2012 at 5:22 PM, Fabrizio Giudici 
>>> >> <fabrizio...@tidalwave.it> wrote: 
>>> >> > On Fri, 02 Nov 2012 21:12:07 +0100, clay <clayt...@gmail.com> 
>>> wrote: 
>>> >> > 
>>> >> >> In hindsight, a simpler solution (with static import of custom 
>>> >> >> toIterable 
>>> >> >> method) would be: 
>>> >> >> 
>>> >> >> final List<String> zips2 = new ArrayList<String>(); 
>>> >> >> for (Person p : people) { for (Address a : 
>>> toIterable(p.addressOption)) 
>>> >> >> { 
>>> >> >> for (String z : toIterable(a.zipOption)) { zips2.add(z); } } } 
>>> >> > 
>>> >> > 
>>> >> > Honestly, I don't find it particularly readable. 
>>> >> > 
>>> >> > 
>>> >> > 
>>> >> > -- 
>>> >> > Fabrizio Giudici - Java Architect @ Tidalwave s.a.s. 
>>> >> > "We make Java work. Everywhere." 
>>> >> > http://tidalwave.it/fabrizio/**blog<http://tidalwave.it/fabrizio/blog>-
>>> >> >  
>>> fabrizio...@tidalwave.it 
>>> >> > 
>>> >> > -- 
>>> >> > You received this message because you are subscribed to the Google 
>>> >> > Groups 
>>> >> > "Java Posse" group. 
>>> >> > To post to this group, send email to java...@googlegroups.com. 
>>> >> > To unsubscribe from this group, send email to 
>>> >> > javaposse+...@googlegroups.com**. 
>>> >> > For more options, visit this group at 
>>> >> > http://groups.google.com/**group/javaposse?hl=en<http://groups.google.com/group/javaposse?hl=en>.
>>> >> >  
>>>
>>> >> > 
>>> > 
>>> > -- 
>>> > You received this message because you are subscribed to the Google 
>>> Groups 
>>> > "Java Posse" group. 
>>> > To view this discussion on the web visit 
>>> > https://groups.google.com/d/**msg/javaposse/-/SBpf_wVxh0gJ<https://groups.google.com/d/msg/javaposse/-/SBpf_wVxh0gJ>.
>>> >  
>>>
>>> > 
>>> > To post to this group, send email to java...@googlegroups.com. 
>>> > To unsubscribe from this group, send email to 
>>> > javaposse+...@**googlegroups.com. 
>>> > For more options, visit this group at 
>>> > http://groups.google.com/**group/javaposse?hl=en<http://groups.google.com/group/javaposse?hl=en>.
>>> >  
>>>
>>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Java Posse" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/javaposse/-/mhPVSnOnsIYJ.
>> To post to this group, send email to java...@googlegroups.com<javascript:>
>> .
>> To unsubscribe from this group, send email to 
>> javaposse+...@googlegroups.com <javascript:>.
>> For more options, visit this group at 
>> http://groups.google.com/group/javaposse?hl=en.
>>
>

-- 
You received this message because you are subscribed to the Google Groups "Java 
Posse" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/javaposse/-/yzc9RMhScTgJ.
To post to this group, send email to javaposse@googlegroups.com.
To unsubscribe from this group, send email to 
javaposse+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to