Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need of creating a refrence to hashmap #4

Open
amarlearning opened this issue Mar 7, 2021 · 0 comments
Open

Need of creating a refrence to hashmap #4

amarlearning opened this issue Mar 7, 2021 · 0 comments

Comments

@amarlearning
Copy link

Can you help me in understanding the need of creating a new reference for hashmap slots named allSlots using the getter method? Considering we can use the class variable slots directly as this.slots.

final Map<Integer, Slot> allSlots = getSlots();
if (!allSlots.containsKey(slotNumber)) {
allSlots.put(slotNumber, new Slot(slotNumber));
}
return allSlots.get(slotNumber);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant