예제 #1
0
 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;
     }
 }
예제 #2
0
 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);
 }
예제 #3
0
 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();
 }
예제 #4
0
 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();
     }
 }