Java implementation of various data structures