Set is an obvious choice if I don't want to duplicate my data list.
However, it Setdoes not have a method get(int index): Why doesn't java.util.Set get (int index)?
A few suggestions for implementing pseudo get(int index)and none of them are effective.
toArray and access the new array by index.- Get an iterator and use a loop
forto access the indexed item in the account.
Is there any advanced data structure that allows me
- Avoid duplication.
- Perform O (1) for
get(int index).
source
share