Infosys interview question

Java collections and string