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 -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -