Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generics vs Objects #3

Open
adelgadocabrera opened this issue Apr 4, 2022 · 2 comments
Open

Generics vs Objects #3

adelgadocabrera opened this issue Apr 4, 2022 · 2 comments

Comments

@adelgadocabrera
Copy link
Collaborator

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

@anchitbhatia
Copy link
Owner

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.

@adelgadocabrera
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants