public virtual bool hasNext() { if (this.nextEntry != null && ((object)this.nextKey != null || this.nextEntry.isNull )) { return(true); } while (true) { if (this.nextEntry == null) { while (this.position < this._enclosing.elementData.Length) { if ((this.nextEntry = this._enclosing.elementData[this.position++]) != null) { break; } } if (this.nextEntry == null) { return(false); } } // ensure key of next entry is not gc'ed this.nextKey = this.nextEntry.get(); if ((object)this.nextKey != null || this.nextEntry.isNull) { return(true); } this.nextEntry = this.nextEntry.next; } }
public override bool contains(object @object) { if (@object is java.util.MapClass.Entry <K, V> ) { java.util.WeakHashMap.Entry <K, V> entry = this._enclosing.getEntry(((java.util.MapClass .Entry <object, object>)@object).getKey()); if (entry != null) { object key = entry.get(); if (key != null || entry.isNull) { return(@object.Equals(entry)); } } } return(false); }
public virtual R next() { if (this.expectedModCount == this._enclosing.modCount) { if (this.hasNext()) { this.currentEntry = this.nextEntry; this.nextEntry = this.currentEntry.next; R result = this.type.get(this.currentEntry); // free the key this.nextKey = default(K); return(result); } throw new java.util.NoSuchElementException(); } throw new java.util.ConcurrentModificationException(); }
public virtual void remove() { if (this.expectedModCount == this._enclosing.modCount) { if (this.currentEntry != null) { this._enclosing.removeEntry(this.currentEntry); this.currentEntry = null; this.expectedModCount++; } else { // cannot poll() as that would change the expectedModCount throw new System.InvalidOperationException(); } } else { throw new java.util.ConcurrentModificationException(); } }