Thread: Syntax

Results 1 to 3 of 3
  1. #1 Syntax 
    Registered Member
    Join Date
    Jul 2009
    Posts
    73
    Thanks given
    0
    Thanks received
    1
    Rep Power
    8
    I was reading the proposed implementation of Lambda Expressions in Java 7, and I came across some syntax I couldn't understand, and couldn't find out in Google what it meant:

    Code:
    <T, throws E extends Exception>
    in (ignore the closure):

    Code:
    public static <T, throws E extends Exception>
    T withLock(Lock lock, #T()throws E block) throws E {
        lock.lock();
        try {
            return block.invoke();
        } finally {
            lock.unlock();
        }
    }
    What is "<T, throws E extends Exception>" supposed to mean? Is it part of the implementation of Lambda Expressions?


    EDIT:

    It goes on to say that this is a valid example of usage of explicit Exceptions using this (again, ignore the closure):

    Code:
    Locks.<throws IOException|NumberFormatException>withLock(lock, #(){
        System.out.println("hello");
    });
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Jul 2008
    Age
    28
    Posts
    5,827
    Thanks given
    1,301
    Thanks received
    197
    Rep Power
    0
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jul 2009
    Posts
    73
    Thanks given
    0
    Thanks received
    1
    Rep Power
    8
    Thank you.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •