I was writing two implementations of a Linked List for an assignment, a Doubly Linked List and a Circular Doubly Linked List. Now as the class representing a Link within the Linked List is the same in both implementations, I want to use it in both.
Now I wonder which approach would be better:
Implement the Link class as a package-private static member class in the first implementation and then use this class in the second implementation or make the Link class a package-private class.
You could move Link up as static member class of a common base class / interface (if you have one). This solution would express that Link is strongly associated with (both implementations of) the linked list.