java inheritance versus composition (implementing a stack)
I am trying to implement a Stack in java (using the list interface: Interface List ). I want to implement it two different ways: using composition and inheritance. For inheritance, so far I have: import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; public class StackInheritance implements List { //implement list methods } For composition, I have: import java.util.List; public abstract class StackComposition implements List { // implement some standard methods } public class StackViaList extends StackComposition { // implement methods