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
Post a Comment