Java implementation of some data structures