Implementing some common Data Structure in Java