Example #1
0
            public Spliterator <E> TrySplit()
            {
                Node <E> p;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final ConcurrentLinkedQueue<E> q = this.queue;
                ConcurrentLinkedQueue <E> q = this.Queue;
                int b = Batch;
                int n = (b <= 0) ? 1 : (b >= MAX_BATCH) ? MAX_BATCH : b + 1;

                if (!Exhausted && ((p = Current) != null || (p = q.First()) != null) && p.Next != null)
                {
                    Object[] a = new Object[n];
                    int      i = 0;
                    do
                    {
                        if ((a[i] = p.Item) != null)
                        {
                            ++i;
                        }
                        if (p == (p = p.Next))
                        {
                            p = q.First();
                        }
                    } while (p != null && i < n);
                    if ((Current = p) == null)
                    {
                        Exhausted = true;
                    }
                    if (i > 0)
                    {
                        Batch = i;
                        return(Spliterators.Spliterator(a, 0, i, java.util.Spliterator_Fields.ORDERED | java.util.Spliterator_Fields.NONNULL | java.util.Spliterator_Fields.CONCURRENT));
                    }
                }
                return(null);
            }
Example #2
0
 public Spliterator <V> Spliterator()
 {
     return(Spliterators.Spliterator(this, Spliterator_Fields.SIZED | Spliterator_Fields.ORDERED));
 }
Example #3
0
 public Spliterator <Map_Entry <K, V> > Spliterator()
 {
     return(Spliterators.Spliterator(this, Spliterator_Fields.SIZED | Spliterator_Fields.ORDERED | Spliterator_Fields.DISTINCT));
 }
Example #4
0
 public Spliterator <K> Spliterator()
 {
     return(Spliterators.Spliterator(this, Spliterator_Fields.SIZED | Spliterator_Fields.ORDERED | Spliterator_Fields.DISTINCT));
 }