Data structure classes in java/ruby