Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29954

Re: How does it know?

X-Received by 10.182.130.168 with SMTP id of8mr5638335obb.27.1410547263419; Fri, 12 Sep 2014 11:41:03 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!r10no960907igi.0!news-out.google.com!ef6ni5169igb.0!nntp.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date Fri, 12 Sep 2014 13:41:02 -0500
Date Fri, 12 Sep 2014 21:40:38 +0300
From Donkey Hottie <donkey@fredriksson.dy.fi>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: How does it know?
References <luv2fd$j58$1@dont-email.me> <luv3up$te6$1@dont-email.me> <p1kbeb-rqd.ln1@s.simpson148.btinternet.com>
In-Reply-To <p1kbeb-rqd.ln1@s.simpson148.btinternet.com>
Message-ID <6arbeb-7lt.ln1@tempest.fredriksson.dy.fi> (permalink)
Lines 40
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-HQT1K909W+t6uoHUEDAWYKyMWpiBbYbdg6thLpDx5f/OIB32EmtKHVlhwir2rMToz1d8wjpN69Qfor2!LpjO50a8mV3dep47SeODmA7lbJ0gefSbwlPIhzDfaRY47dyqxxAiMLrJu6CYm69fxhPWVg==
X-Complaints-To abuse@giganews.com
X-DMCA-Notifications http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2197
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
Xref csiph.com comp.lang.java.programmer:29954

Show key headers only | View raw


12.09.2014, 19:36, Steven Simpson kirjoitti:
> On 12/09/14 16:36, Knute Johnson wrote:
>> On 9/12/2014 08:11, Knute Johnson wrote:
>>> The second question is, what type is test.main()?  I want to be able to
>>> put it into a Map.
>>
>> Now that I think about it, I don't think that is possible.
> 
> import java.util.*;
> 
> public class TestApplication {
>     public interface Application {
>         void main(String... args) throws Exception;
>     }
> 
>     public static void main(String[] args) {
>         Map<String, Application> map = new HashMap<>();
>         map.put("self", TestApplication::main);
>     }
> }
> 
> 
> 

That does not compute. Or is this some Java 8 new feature? I thought
methods are not "first class citizens" in Java...

I would say

map.put("something", new Application {
   void main(String... args) throws Exception
   {
      throw new Exception("WTF?");
   }
});


-- 

Avert misunderstanding by calm, poise, and balance.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-12 08:11 -0700
  Re: How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-12 08:36 -0700
    Re: How does it know? Steven Simpson <ss@domain.invalid> - 2014-09-12 17:36 +0100
      Re: How does it know? Donkey Hottie <donkey@fredriksson.dy.fi> - 2014-09-12 21:40 +0300
        Re: How does it know? Joerg Meier <joergmmeier@arcor.de> - 2014-09-13 11:57 +0200
  Re: How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-12 16:18 -0700
    Re: How does it know? Mike Amling <mamling@chaff.us> - 2014-09-14 08:52 -0500
      Re: How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-14 07:48 -0700
  Re: How does it know? Roedy Green <see_website@mindprod.com.invalid> - 2014-09-12 18:11 -0700
    Re: How does it know? Joerg Meier <joergmmeier@arcor.de> - 2014-09-13 11:59 +0200
      Re: How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-14 07:51 -0700
        Re: How does it know? Arne Vajhøj <arne@vajhoej.dk> - 2014-09-14 22:24 -0400
    Re: How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-14 07:50 -0700
      Re: How does it know? Arne Vajhøj <arne@vajhoej.dk> - 2014-09-14 22:26 -0400
        Re: How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-17 14:52 -0700
  Re: How does it know? Roedy Green <see_website@mindprod.com.invalid> - 2014-09-12 18:13 -0700
  Re: How does it know? Mike Amling <mamling@chaff.us> - 2014-09-14 08:29 -0500
    Re: How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-14 07:53 -0700
      Re: How does it know? Roedy Green <see_website@mindprod.com.invalid> - 2014-09-17 00:40 -0700
        Re: How does it know? Joerg Meier <joergmmeier@arcor.de> - 2014-09-18 00:10 +0200

csiph-web