/** * Compares this map with another map for equality of their stored * entries. * * @param other an <code>Object</code> value * @return a <code>boolean</code> value */ public boolean equals( Object other ) { if ( ! ( other instanceof TObjectLongMap ) ) { return false; } TObjectLongMap that = ( TObjectLongMap ) other; if ( that.size() != this.size() ) { return false; } try { TObjectLongIterator iter = this.iterator(); while ( iter.hasNext() ) { iter.advance(); Object key = iter.key(); long value = iter.value(); if ( value == no_entry_value ) { if ( !( that.get( key ) == that.getNoEntryValue() && that.containsKey( key ) ) ) { return false; } } else { if ( value != that.get( key ) ) { return false; } } } } catch ( ClassCastException ex ) { // unused. } return true; }
/** * Compares this map with another map for equality of their stored * entries. * * @param other an <code>Object</code> value * @return a <code>boolean</code> value */ @Override @SuppressWarnings("rawtypes") public boolean equals( Object other ) { if ( ! ( other instanceof TObjectLongMap ) ) { return false; } TObjectLongMap that = ( TObjectLongMap ) other; if ( that.size() != this.size() ) { return false; } try { TObjectLongIterator iter = this.iterator(); while ( iter.hasNext() ) { iter.advance(); Object key = iter.key(); long value = iter.value(); if ( value == no_entry_value ) { if ( !( that.get( key ) == that.getNoEntryValue() && that.containsKey( key ) ) ) { return false; } } else { if ( value != that.get( key ) ) { return false; } } } } catch ( ClassCastException ex ) { // unused. } return true; }
public static boolean throttle(InetAddress address) { synchronized (tracker) { long ctime = System.currentTimeMillis(); TObjectLongIterator<InetAddress> iterator = tracker.iterator(); while (iterator.hasNext()) { iterator.advance(); if (iterator.value() < ctime) { iterator.remove(); } } long ret = tracker.put(address, ctime + time); return ret != tracker.getNoEntryValue(); } }
/** * @return an iterator over the entries in this map */ public TObjectLongIterator<K> iterator() { return new TObjectLongHashIterator<K>( this ); }
/** * @return an iterator over the entries in this map */ @Override public TObjectLongIterator<K> iterator() { return new TObjectLongHashIterator( this ); }
public TObjectLongIterator<String> iterator() { return container.iterator(); }
public TObjectLongIterator<K> iterator() { return container.iterator(); }
/** * Returns a <tt>TObjectLongIterator</tt> with access to this map's keys and values. * * @return a <tt>TObjectLongIterator</tt> with access to this map's keys and values. */ public TObjectLongIterator<K> iterator();