com.gemstone.gbj

## Class GbjIterator

- java.lang.Object
- - com.gemstone.gbj.GbjIterator

- All Implemented Interfaces:
    java.util.Enumeration

      public class GbjIterator
      extends java.lang.Object
      implements java.util.Enumeration

  Instances of this class iterate over collections in the GemStone server. Contents of the collection are sequenced on the server and cached in batches in Java for efficiency.

  ## GBJ30 Changes

  ### Constructor Changes

  GbjIterator(GbjObject[] initialCache) no longer supported.

  New constructor GbjIterator(GbjObject onCollection, long startingIdx) .

  Version:
    3.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `BatchSize` Specifies batch size.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GbjIterator(GbjCollection onCollection)` Usual Constructor
    `GbjIterator(GbjObject onCollection)` Usual Constructor.
    `GbjIterator(GbjObject onCollection, long startingIdx)` Constructor with starting index

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `hasMoreElements()` Return true if there are more elements to return from this iterator.
    `java.lang.Object` | `nextElement()` Return the next element from this iterator.
    `GbjObject[]` | `remainingElements()` Return all of the remaining elements left in the iterator.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### BatchSize

          public static int BatchSize

      Specifies batch size. Default size is 1000, can be redefined by the application

  - ### Constructor Detail

    - #### GbjIterator

          public GbjIterator(GbjObject onCollection,
                             long startingIdx)

      Constructor with starting index
      Parameters:
        `onCollection` - collection to iterate over
        `startingIdx` - starting index for iteration

    - #### GbjIterator

          public GbjIterator(GbjObject onCollection)

      Usual Constructor.
      Parameters:
        `onCollection` - collection to iterate over

    - #### GbjIterator

          public GbjIterator(GbjCollection onCollection)

      Usual Constructor
      Parameters:
        `onCollection` - collection to iterate over

  - ### Method Detail

    - #### hasMoreElements

          public boolean hasMoreElements()

      Return true if there are more elements to return from this iterator.
      Specified by:
        `hasMoreElements` in interface `java.util.Enumeration`
      Returns:
        boolean result

    - #### nextElement

          public java.lang.Object nextElement()

      Return the next element from this iterator. If no more elements are available, throw an error.
      Specified by:
        `nextElement` in interface `java.util.Enumeration`
      Returns:
        object result

    - #### remainingElements

          public GbjObject[] remainingElements()

      Return all of the remaining elements left in the iterator. Note: Maximum number of elements that can be returned is Integer.MAX_VALUE.
      Returns:
        ObjObject array with elements