@Override
    public Object[] toArray() {
      List temp = new ArrayList(size());
      // do NOT use addAll or this results in stack overflow - must use iterator()
      for (Object o : this) {
        temp.add(o);
      }
      return temp.toArray();
    }
@param nullOK if true, return null instead of throwing NoSuchElementException
@return the next element
geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java