Basic data structures in Java, re-implemented for learning