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); }
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); }
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); }
public K Next() { return(setIterator.Next().Key); }