Beispiel #1
0
 public static void ForEach(Iterable <V> @this, java.util.function.Consumer consumer)
 {
     java.util.Iterator <V> i = @this.Iterator();
     while (i.HasNext())
     {
         consumer.Accept(i.Next());
     }
 }
Beispiel #2
0
 public virtual void Clear()
 {
     java.util.Iterator <V> i = Iterator();
     while (i.HasNext())
     {
         i.Next();
         i.Remove();
     }
 }
Beispiel #3
0
 public static void ForEach(Map <K, V> @this, java.util.function.BiConsumer biconsumer)
 {
     java.util.Iterator <K> i = @this.KeySet().Iterator();
     while (i.HasNext())
     {
         K key   = i.Next();
         V value = @this.Get(key);
         biconsumer.Accept(key, value);
     }
 }
Beispiel #4
0
 public virtual bool Remove(V o)
 {
     java.util.Iterator <V> i = Iterator();
     while (i.HasNext())
     {
         object e = i.Next();
         if (o == null ? e == null : o.Equals(e))
         {
             i.Remove();
             return(true);
         }
     }
     return(false);
 }
Beispiel #5
0
        public static bool RemoveIf(Collection <V> @this, java.util.function.Predicate predicate)
        {
            java.util.Iterator <V> i = @this.Iterator();
            bool didremove           = false;

            while (i.HasNext())
            {
                object o = i.Next();
                if (predicate.Test(o))
                {
                    didremove = true;
                    i.Remove();
                }
            }
            return(didremove);
        }
Beispiel #6
0
        public virtual bool RemoveAll(Collection <V> c)
        {
            java.util.Iterator <V> i = Iterator();
            bool didremove           = false;

            while (i.HasNext())
            {
                V o = i.Next();
                if (c.Contains(o))
                {
                    didremove = true;
                    i.Remove();
                }
            }
            return(didremove);
        }