Java Guru needed -- compiler bug?

by Zsolt Vasvari » Fri, 20 May 2011 16:50:55 GMT


Sponsored Links
 private void method(Collection<String> s)
    {
        // Nothing
    }


    private void caller()
    {
       // Complies fine
        Collection<String> s = Collections.emptyList();
        method(s);

       // Doesn't compile -- gives error message
       // The method method(Collection<String>) in the type Import is
not applicable for the arguments
       //  (List<Object>)
        method(Collections.emptyList());
    }


What's going on here?   The two statements look identical to me...

-- 



Re: Java Guru needed -- compiler bug?

by Nikolay Elenkov » Fri, 20 May 2011 16:57:01 GMT


 


I'm not going to pretend to be a guru, but here goes :)

It's a generic method:

public static final <T> List<T> emptyList()

In the second call there is no way to determine the type of the generic
parameter, so you get a list of Object.

-- 


Sponsored Links


Other Threads

1. All SYMBIAN based end devices accept Java language Applications :: Need Clarifications

For the link u may refer;
http://www.macrobug.com/blog/2007/12/08/android-versus-symbian-os/

section :: End-user openness

Thanks.







--~--~---------~--~----~------------~-------~--~----~

2. Process is not ending ?

Hi All,

Can anyone tell me where can I see the active process and current
process. I think we can see in the DDMS --> Devices.

But when see the process list, when I launch a application it showing
that applications process in the list. after finishing that
application also it showing it process in the process list.

So how can see only the current active prcocess
(Foregroud,Background..etc). I want to see only the current process
which running on the device/emulator.

One more thing. when I hold on the Home button for long time, It is
showing a list. What that list means. whether that list is For the
forgrund running apps or active apps or that is a History.



Please any one answer my simple questions.


Best,

AndRaj
--~--~---------~--~----~------------~-------~--~----~

3. how can i check landscap orientation ?

4. How to make single row Menu with 4 MenuItem?

5. Task activity stack always reset when launched from Home

6. Singleton in different service which share same process

7. How to change orientation of AlertDialog?