Implementation of ADTs in Java