Open adelgadocabrera opened 2 years ago
Yes generics would have been more elegant. But i am wondering if there are any performance benefit that one has over the other? I need to research for a quick comparison between using Object class and using Generics.
I have never used Object and tbh, I don't think there is going to be any performance diff (I might be surprised) I think it is just more elegant because it is informing the developer about dynamically typed class.
I honestly don't know which one is a best practice. Personally, I feel like generics are more elegant but perhaps it is a topic we could ask in class.
So instead of using Object I would rather use a generic.
https://github.com/CS682-S22/dsd-pub-sub-project-anchitbhatia/blob/1cdf79e83816160c8ea636020afb70f7988ad19b/src/main/java/utils/Helper.java#L41