I'm making a program in which I need to save objects that are not repeated and must be sorted into a data structure. Access, modification and removal of the object have to be very efficient.
First I thought about making a Map < String,Object > where the key is the name (attribute) of the object. But my teacher told me it was inefficient because I was duplicating content and I should have to create my own structure without using lists, vectors, .. or at least not directly, that is, I have to override the implementation.
But I do not know where to start and what is a good choice. What advice would you give me to access the object through its name in an efficient way?
Thanks!
You didn't mention how efficient it needs to be so I assume a TreeSet
is what you need
Operations you mentioned are done in log(n)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments