本文整理汇总了C#中Collection.iterator方法的典型用法代码示例。如果您正苦于以下问题:C# Collection.iterator方法的具体用法?C# Collection.iterator怎么用?C# Collection.iterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collection
的用法示例。
在下文中一共展示了Collection.iterator方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: containsAll
public virtual bool containsAll(Collection c)
{
Iterator i = c.iterator();
while (i.hasNext())
{
object val = i.next();
if (!contains(val))
return false;
}
return true;
}
示例2: addAll
public virtual bool addAll(Collection c)
{
int count = size();
Iterator i = c.iterator();
while (i.hasNext())
{
object val = i.next();
add(val);
}
return count != size();
}
示例3: join
public static string join(string delimiter, Collection values)
{
StringBuffer stringBuffer = new StringBuffer();
Iterator iterator = values.iterator();
while (iterator.hasNext())
{
object obj = iterator.next();
stringBuffer.append(ParameterizedAssertionError.stringValueOf(obj));
if (iterator.hasNext())
stringBuffer.append(delimiter);
}
return stringBuffer.toString();
}
示例4: calculateMean
public static double calculateMean(Collection values, bool includeNullAndNaN)
{
int num1 = includeNullAndNaN ? 1 : 0;
if (values == null)
{
string str = "Null 'values' argument.";
Throwable.__\u003CsuppressFillInStackTrace\u003E();
throw new IllegalArgumentException(str);
}
else
{
int num2 = 0;
double num3 = 0.0;
Iterator iterator = values.iterator();
while (iterator.hasNext())
{
object obj = iterator.next();
if (obj == null)
{
if (num1 != 0)
return double.NaN;
}
else if (obj is Number)
{
Number number = (Number) obj;
if (Double.isNaN(number.doubleValue()))
{
if (num1 != 0)
return double.NaN;
}
else
{
num3 += number.doubleValue();
++num2;
}
}
}
return num3 / (double) num2;
}
}
示例5: containsAll
public bool containsAll(Collection c)
{
Iterator i = c.iterator();
while (i.hasNext())
{
object key = i.next();
if (!mHashTable.ContainsKey(key))
return false;
}
return true;
}
示例6: addAll
public bool addAll(Collection c)
{
bool modified = false;
int count = mSource.size();
Iterator i = c.iterator();
while (i.hasNext())
{
object key = i.next();
object val = mSource.put(key, null);
if (val != null)
{
modified = true;
}
}
return modified || (mSource.size() != count);
}
示例7: removeAll
public bool removeAll(Collection c)
{
int count = mSource.size();
Iterator i = c.iterator();
while (i.hasNext())
{
MapEntry e = (MapEntry)i.next();
mSource.remove(e.getKey());
}
return count != mSource.size();
}
示例8: containsAll
public bool containsAll(Collection c)
{
Iterator i = c.iterator();
while (i.hasNext())
{
MapEntry e = (MapEntry)i.next();
if (!mSource.containsKey(e.getKey()))
return false;
}
return true;
}
示例9: deepClone
public static Collection deepClone(Collection collection)
{
if (collection == null)
{
string str = "Null 'collection' argument.";
Throwable.__\u003CsuppressFillInStackTrace\u003E();
throw new IllegalArgumentException(str);
}
else
{
Collection collection1 = (Collection) ObjectUtilities.clone((object) collection);
collection1.clear();
Iterator iterator = collection.iterator();
while (iterator.hasNext())
{
object @object = iterator.next();
if (@object != null)
collection1.add(ObjectUtilities.clone(@object));
else
collection1.add((object) null);
}
return collection1;
}
}
示例10: removeAll
public bool removeAll(Collection c)
{
int count = size();
Iterator i = c.iterator();
while (i.hasNext())
{
object o = i.next();
remove(o);
}
return count != size();
}
示例11: retainAll
public bool retainAll(Collection c)
{
int count = mHashMap.mHashTable.Count;
Iterator i = c.iterator();
while (i.hasNext())
{
MapEntry me = (MapEntry)i.next();
object val = mHashMap.mHashTable[me.getKey()];
if (val != me.getValue())
{
if (!mHashMap.mHashTable.ContainsKey(me.getKey()))
mHashMap.mHashTable.Add(me.getKey(), me.getValue());
else
mHashMap.mHashTable.Remove(me.getKey());
}
}
return mHashMap.mHashTable.Count != count;
}
示例12: removeAll
public bool removeAll(Collection c)
{
int count = mHashMap.mHashTable.Count;
Iterator i = c.iterator();
while (i.hasNext())
{
MapEntry me = (MapEntry)i.next();
mHashMap.mHashTable.Remove(me.getKey());
}
return mHashMap.mHashTable.Count != count;
}
示例13: addAll
public bool addAll(Collection c)
{
int count = mHashMap.mHashTable.Count;
Iterator i = c.iterator();
while (i.hasNext())
{
MapEntry me = (MapEntry)i.next();
mHashMap.mHashTable[me.getKey()] = me.getValue();
}
return mHashMap.mHashTable.Count != count;
}
示例14: retainAll
public bool retainAll(Collection c)
{
int count = size();
Iterator i = c.iterator();
while (i.hasNext())
{
object o = i.next();
if (!contains(o))
add(o);
else
remove(o);
}
return count != size();
}