Advertisement
is_a_cdr

GenericCollectionElement.java

Jul 20th, 2012
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1.     private <T extends Element> T cache(T newElement)
  2.     {
  3.         ElementKey key = newElement.getKey();
  4.         Element existingElement = _elements.get(key);
  5.         if(existingElement != null)
  6.             //Unchecked cast.
  7.             return (T)existingElement;
  8.         else
  9.         {
  10.             _elements.put(key, newElement);
  11.             return newElement;
  12.         }
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement