# Tag Info

0

This is bound to be very opinion-based (like many reviews are). However, if your business class basically represents a collection of objects, implementing Iterable is the right thing to do. I'd even go so far to say, that not implementing Iterable is a sign of neglect. Extending the class from a given collection type instead is not a good thing, as it ...

0

IIUC, you want the class People to have all the functionality of Set<Person> with some additional custom methods. In this case, one option is to extend a concrete Set<Person> implementation like HashSet<Person>: class People extends HashSet<Person> { // All other methods are inherited from HashSet<Person> public Set<...

9

You've essentially built a doubly-linked list that also performs its own memory management. Regarding linked lists: This makes indexing is an $O(n)$ operation, compared to $O(1)$ for List<T>. Searching from the end for indexes beyond the center helps, but it does not fundamentally change this performance characteristic. Adding is an $O(1)$ ...

21

This is called a doubly linked list. List<T> is basically a wrapper around an array. The only operations where you can hope to be faster are insertions and deletions from the middle of the list. Using Marshal unless you absolutely have to is a bad idea, if not a plain crazy one. This code has memory leaks (how is that destructor meant to release all ...

2

equals You have provided this method, but don't reuse it in the other methods. For instance, when you do: if(!equalsCheck.equals(aNxt, bNxt)) { return false; } you could have done the below to take into account the null checks: if(!equals(aNxt, bNxt, equalsCheck)) { return false; } equalsSet This could improved, by: make buffer ...

Top 50 recent answers are included