Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active January 17, 2026 13:07
Show Gist options
  • Select an option

  • Save mcsee/9780cd7772afddbc8356bab8aa5eabed to your computer and use it in GitHub Desktop.

Select an option

Save mcsee/9780cd7772afddbc8356bab8aa5eabed to your computer and use it in GitHub Desktop.
This gist belongs to Clean Code Cookbook http://cleancodecookbook.com By Maximiliano Contieri http://maximilianocontieri.com
class Stack extends ArrayList {
public void push(Object value) { … }
public Object pop() { … }
}
// Stack doesn't behave Like an ArrayList
// besides pop, push, top it also implements (or overrides)
// get, set, add, remove and clear
// stack elements can be arbitrary accessed
// both classes are concrete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment