Decided to use ArrayList rather than LinkedList for storing pattern due to better memory performance.