Esempio n. 1
0
        public override bool RemoveAll(ICollection <E> collection)
        {
            bool result = false;

            if (Count <= collection.Count)
            {
                IIterator <E> it = Iterator();
                while (it.HasNext())
                {
                    if (collection.Contains(it.Next()))
                    {
                        it.Remove();
                        result = true;
                    }
                }
            }
            else
            {
                foreach (E e in collection)
                {
                    result = Remove(e) || result;
                }
            }
            return(result);
        }
Esempio n. 2
0
            public Object[] ToArray(Object[] array)
            {
                int size  = enumMap.Count;
                int index = 0;

                Object[] entryArray = array;
                if (size > array.Length)
                {
                    Type clazz = array.GetType().GetElementType();
                    entryArray = (Object[])ILOG.J2CsMapping.Collections.Arrays.NewInstance(clazz, size);
                }
                IIterator <KeyValuePair <KT, VT> > iter = Iterator();

                for (; index < size; index++)
                {
                    KeyValuePair <KT, VT> entry = iter.Next();
                    entryArray[index] = new KeyValuePair <KT, VT>(entry.Key, entry
                                                                  .Value);
                }
                if (index < array.Length)
                {
                    entryArray[index] = null;
                }
                return(entryArray);
            }
Esempio n. 3
0
        public override int GetHashCode()
        {
            int           result = 0;
            IIterator <E> it     = Iterator();

            while (it.HasNext())
            {
                Object next = it.Next();
                result += next == null ? 0 : next.GetHashCode();
            }
            return(result);
        }
Esempio n. 4
0
 public AnonymousIterator(AbstractMap <K, V> enclosing)
 {
     setIterator = new IteratorAdapter <KeyValuePair <K, V> >(enclosing.EntrySet().GetEnumerator());
 }