I believe I've found a bottleneck that causes shape finding to run
slowly. See the Bag class. When merging shapes, we would call
ArrayList's addAll() method and it converts the list into an array
before adding them together for O(n) time. Using a linked list this
could be made into O(1) time.