Playing with data structures and trying to implement them in Java