Data Structure related Java code