Example #1
0
        public override int IndexOf(T item)
        {
            int len = Length;

            for (int i = 0; i < len; i++)
            {
                var at = GetElementAt(i);
                try {
                    if (EqualityComparer <T> .Default.Equals(item, at) || JniMarshal.RecursiveEquals(item, at))
                    {
                        return(i);
                    }
                } finally {
                    var j = at as IJavaPeerable;
                    if (j != null)
                    {
                        j.DisposeUnlessReferenced();
                    }
                }
            }
            return(-1);
        }
Example #2
0
        public override int IndexOf(T item)
        {
            int len = Length;

            for (int i = 0; i < len; i++)
            {
                var at = GetElementAt(i);
                try {
#pragma warning disable CS8604 // Possible null reference argument.
                    if (EqualityComparer <T> .Default.Equals(item, at) || JniMarshal.RecursiveEquals(item, at))
#pragma warning restore CS8604 // Possible null reference argument.
                    {
                        return(i);
                    }
                } finally {
                    var j = at as IJavaPeerable;
                    if (j != null)
                    {
                        j.DisposeUnlessReferenced();
                    }
                }
            }
            return(-1);
        }