What could be wrong with implementing a stack with an arrayList?
Utilisateur anonyme
- ArrayList doesn't guarantee LIFO, you'll have all the methods to access any element anywhere. You'll need to wrap it inside a class for the Stack and implement the restrictions yourself. - Every time the arraylist has to resize, there will be O(n) implicit cost for that even though JAVA will take care of that for us. PS: Anything else? feedback welcomed.