コード例 #1
0
ファイル: FastArray.cs プロジェクト: AlexTagun/Xelon
    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;
            }
        }
    }
コード例 #2
0
ファイル: FastArray.cs プロジェクト: AlexTagun/Xelon
    //-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>());
    }