Pergunta de entrevista da empresa Barclays

In general I was asked the simplest questions in Barcap. The most difficult tech question was: (Java question) . Suppose you have a class which has a HashMap as an instance variable. How do you design a getter method so that the map returned does not corrupt the original map.

Resposta da entrevista

Sigiloso

28 de out. de 2012

I answered that you can wrap the original map with Collections.unmodifiableMap() to leave the original map intact.

3