+ Start a Discussion
logontokartiklogontokartik 

Generics in Apex Code

Did anyone try to implement Generics in Apex Code?

Similar to java <T> type?

Can anyone please transform the below line in Apex? 

public static <T> NamedValue<T> create(String name, T value)

I might be stupid asking this question instead of using SObjectType but I wanted to confirm if this funtionality is totally present or if any limitations.

 

Thanks.

Kartik

 

Best Answer chosen by Admin (Salesforce Developers) 
Ankit AroraAnkit Arora

Per my knowledge generics are not supported in apex.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

All Answers

Ankit AroraAnkit Arora

Per my knowledge generics are not supported in apex.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

This was selected as the best answer
logontokartiklogontokartik

Well. Yes. I tried to do some programming using and it definitely doesnt accept generics as in Java.

 

Thanks

Kartik