When is a parameterized method call useful?

Posted by johann-christoph-jacob on Stack Overflow See other posts from Stack Overflow or by johann-christoph-jacob
Published on 2010-05-06T14:08:57Z Indexed on 2010/05/06 14:18 UTC
Read the original article Hit count: 185

Filed under:
|
|
|
|

A Java method call may be parameterized like in the following code:

class Test
{
    <T> void test()
    {
    }

    public static void main(String[] args)
    {
        new Test().<Object>test();
        //         ^^^^^^^^
    }
}

I found out this is possible from the Eclipse Java Formatter settings dialog and wondered if there are any cases where this is useful or required.

© Stack Overflow or respective owner

Related posts about java

Related posts about generics