コード例 #1
0
 public SortedMap<String, T> getAsMap() {
   SortedMap<String, T> map = new TreeMap<String, T>();
   for (T o : getStore()) {
     map.put(namer.determineName(o), o);
   }
   return map;
 }
コード例 #2
0
 /**
  * Subclasses that can guarantee that the backing store enforces name uniqueness should override
  * this to simply call super.add(T) (avoiding an unnecessary lookup)
  */
 public boolean add(T o) {
   if (!hasWithName(namer.determineName(o))) {
     return super.add(o);
   } else {
     handleAttemptToAddItemWithNonUniqueName(o);
     return false;
   }
 }
コード例 #3
0
 protected T findByNameWithoutRules(String name) {
   for (T o : getStore()) {
     if (name.equals(namer.determineName(o))) {
       return o;
     }
   }
   return null;
 }