public void iterateWithRemove(ElementPredicate inPredicate, bool inUseSwapRemove = false) { int theIndex = 0; while (theIndex < getSize()) { bool theDoRemove = inPredicate.Invoke(_elements[theIndex]); if (theDoRemove) { removeElementAt(theIndex, inUseSwapRemove); } else { ++theIndex; } } }
//-Find public Optional <int> findIndex(ElementPredicate inPredicate) { if (null == inPredicate) { return(new Optional <int>()); } XUtils.check(null != inPredicate); int theIndex = 0; foreach (T_ElementType theElement in this) { if (inPredicate.Invoke(theElement)) { return(new Optional <int>(theIndex)); } ++theIndex; } return(new Optional <int>()); }