Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private <T extends Element> T cache(T newElement)
- {
- ElementKey key = newElement.getKey();
- Element existingElement = _elements.get(key);
- if(existingElement != null)
- //Unchecked cast.
- return (T)existingElement;
- else
- {
- _elements.put(key, newElement);
- return newElement;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement