java - generic return object -



java - generic return object -

recently reading next piece of code oracle collection tutorial when came across piece of code.

public static <e> set<e> removedups(collection<e> c) { homecoming new linkedhashset<e>(c); }

i not able understand why returned value

<e> set<e> , not set<e> ?

the homecoming type is, in fact, set<e>.

the other <e> there indicate generic method, , state e parameter generic. without <e>, compiler assume e existing class, , seek locate (producing error if no class named e in scope).

java collections

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

wordpress - Apache index.php redirect for base and sub directory -

content management system - How to allow only English submissions on Pligg CMS -