Exemplo n.º 1
0
 /** {@inheritDoc} */
 @Override
 public boolean equals(Object other) {
   if (!(other instanceof TFloatObjectMap)) {
     return false;
   }
   TFloatObjectMap that = (TFloatObjectMap) other;
   if (that.size() != this.size()) {
     return false;
   }
   try {
     TFloatObjectIterator iter = this.iterator();
     while (iter.hasNext()) {
       iter.advance();
       float key = iter.key();
       Object value = iter.value();
       if (value == null) {
         if (!(that.get(key) == null && that.containsKey(key))) {
           return false;
         }
       } else {
         if (!value.equals(that.get(key))) {
           return false;
         }
       }
     }
   } catch (ClassCastException ex) {
     // unused.
   }
   return true;
 }
Exemplo n.º 2
0
 /**
  * Creates a new <code>TFloatObjectHashMap</code> that contains the entries in the map passed to
  * it.
  *
  * @param map the <tt>TFloatObjectMap</tt> to be copied.
  */
 public TFloatObjectHashMap(TFloatObjectMap<V> map) {
   this(map.size(), 0.5f, map.getNoEntryKey());
   putAll(map);
 }
 public int size() {
   synchronized (mutex) {
     return m.size();
   }
 }