Package org.zkoss.zk.ui.util

## Class ForEachImpl

- java.lang.Object
- - org.zkoss.zk.ui.util.ForEachImpl

- All Implemented Interfaces:
    `ForEach`

      public class ForEachImpl
      extends java.lang.Object
      implements ForEach

  An implementation of `ForEach`.

  Note: the use of `ForEachImpl` is different from `ConditionImpl`. While you could use the same instance of `ConditionImpl` for all evaluation, each instance of `ForEachImpl` can be used only once (drop it after `next()` returns false).

  Author:
    tomyeh

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ForEachImpl​(EvaluatorRef evalr, Component comp, java.lang.String expr, java.lang.String begin, java.lang.String end)` | Constructor.
    `ForEachImpl​(EvaluatorRef evalr, Component comp, ExValue[] expr, ExValue begin, ExValue end)` | Constructor.
    `ForEachImpl​(EvaluatorRef evalr, Component comp, ExValue[] expr, ExValue begin, ExValue end, ExValue step)` | Constructor.
    `ForEachImpl​(EvaluatorRef evalr, Page page, java.lang.String expr, java.lang.String begin, java.lang.String end)` | Constructor.
    `ForEachImpl​(EvaluatorRef evalr, Page page, ExValue[] expr, ExValue begin, ExValue end)` | Constructor.
    `ForEachImpl​(EvaluatorRef evalr, Page page, ExValue[] expr, ExValue begin, ExValue end, ExValue step)` | Constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static ForEach` | `getInstance​(EvaluatorRef evalr, Component comp, java.lang.String expr, java.lang.String begin, java.lang.String end)` | Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.
    `static ForEach` | `getInstance​(EvaluatorRef evalr, Component comp, ExValue[] expr, ExValue begin, ExValue end)` | Returns an instance that represents the iterator for the specified collection.
    `static ForEach` | `getInstance​(EvaluatorRef evalr, Component comp, ExValue[] expr, ExValue begin, ExValue end, ExValue step)` | Returns an instance that represents the iterator for the specified collection.
    `static ForEach` | `getInstance​(EvaluatorRef evalr, Page page, java.lang.String expr, java.lang.String begin, java.lang.String end)` | Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.
    `static ForEach` | `getInstance​(EvaluatorRef evalr, Page page, ExValue[] expr, ExValue begin, ExValue end)` | Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.
    `static ForEach` | `getInstance​(EvaluatorRef evalr, Page page, ExValue[] expr, ExValue begin, ExValue end, ExValue step)` | Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.
    `boolean` | `next()` | Advanced to the next element.

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

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

- - ### Constructor Detail

    - #### ForEachImpl

          public ForEachImpl​(EvaluatorRef evalr,
                             Component comp,
                             ExValue[] expr,
                             ExValue begin,
                             ExValue end,
                             ExValue step)

      Constructor. In most cases, use `getInstance(EvaluatorRef, Component, ExValue[], ExValue, ExValue, ExValue)` instead of this constructor.
      Throws:
        `java.lang.IllegalArgumentException` - if comp or evalr is null
      Since:
        8.0.0

    - #### ForEachImpl

          public ForEachImpl​(EvaluatorRef evalr,
                             Page page,
                             ExValue[] expr,
                             ExValue begin,
                             ExValue end,
                             ExValue step)

      Constructor. In most cases, use `getInstance(EvaluatorRef, Component, ExValue[], ExValue, ExValue, ExValue)` instead of this constructor.
      Throws:
        `java.lang.IllegalArgumentException` - if page or evalr is null
      Since:
        8.0.0

    - #### ForEachImpl

          public ForEachImpl​(EvaluatorRef evalr,
                             Component comp,
                             ExValue[] expr,
                             ExValue begin,
                             ExValue end)

      Constructor. In most cases, use `getInstance(EvaluatorRef, Component, ExValue[], ExValue, ExValue)` instead of this constructor.
      Throws:
        `java.lang.IllegalArgumentException` - if comp or evalr is null
      Since:
        3.0.6

    - #### ForEachImpl

          public ForEachImpl​(EvaluatorRef evalr,
                             Page page,
                             ExValue[] expr,
                             ExValue begin,
                             ExValue end)

      Constructor. In most cases, use `getInstance(EvaluatorRef, Component, ExValue[], ExValue, ExValue)` instead of this constructor.
      Throws:
        `java.lang.IllegalArgumentException` - if page or evalr is null
      Since:
        3.0.6

    - #### ForEachImpl

          public ForEachImpl​(EvaluatorRef evalr,
                             Component comp,
                             java.lang.String expr,
                             java.lang.String begin,
                             java.lang.String end)

      Constructor. In most cases, use `getInstance(EvaluatorRef, Component, String, String, String)` instead of this constructor.
      Throws:
        `java.lang.IllegalArgumentException` - if comp or evalr is null
      Since:
        3.0.0
      See Also:
        `ForEachImpl(EvaluatorRef, Component, ExValue[], ExValue, ExValue)`

    - #### ForEachImpl

          public ForEachImpl​(EvaluatorRef evalr,
                             Page page,
                             java.lang.String expr,
                             java.lang.String begin,
                             java.lang.String end)

      Constructor. In most cases, use `getInstance(EvaluatorRef, Component, String, String, String)` instead of this constructor.
      Throws:
        `java.lang.IllegalArgumentException` - if page or evalr is null
      Since:
        3.0.0
      See Also:
        `ForEachImpl(EvaluatorRef, Page, ExValue[], ExValue, ExValue)`

  - ### Method Detail

    - #### getInstance

          public static ForEach getInstance​(EvaluatorRef evalr,
                                            Component comp,
                                            ExValue[] expr,
                                            ExValue begin,
                                            ExValue end)

      Returns an instance that represents the iterator for the specified collection.
      Parameters:
        `expr` - an array of expressions. There are two formats.
        1. length == 1: it iterates thru the content of expr[0]. For example, if expr[0] is an array, all items in this array will be iterated.
        2. length > 1, it will iterate thru expr[0]
        3. length == 0 or expr is null, null is returned
      Since:
        3.0.6

    - #### getInstance

          public static ForEach getInstance​(EvaluatorRef evalr,
                                            Page page,
                                            ExValue[] expr,
                                            ExValue begin,
                                            ExValue end)

      Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.
      Parameters:
        `expr` - an array of expressions. There are two formats.
        1. length == 1: it iterates thru the content of expr[0]. For example, if expr[0] is an array, all items in this array will be iterated.
        2. length > 1, it will iterate thru expr[0]
        3. length == 0 or expr is null, null is returned
      Since:
        3.0.6

    - #### getInstance

          public static ForEach getInstance​(EvaluatorRef evalr,
                                            Component comp,
                                            ExValue[] expr,
                                            ExValue begin,
                                            ExValue end,
                                            ExValue step)

      Returns an instance that represents the iterator for the specified collection.
      Parameters:
        `expr` - an array of expressions. There are two formats.
        1. length == 1: it iterates thru the content of expr[0]. For example, if expr[0] is an array, all items in this array will be iterated.
        2. length > 1, it will iterate thru expr[0]
        3. length == 0 or expr is null, null is returned
      Since:
        8.0.0

    - #### getInstance

          public static ForEach getInstance​(EvaluatorRef evalr,
                                            Page page,
                                            ExValue[] expr,
                                            ExValue begin,
                                            ExValue end,
                                            ExValue step)

      Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.
      Parameters:
        `expr` - an array of expressions. There are two formats.
        1. length == 1: it iterates thru the content of expr[0]. For example, if expr[0] is an array, all items in this array will be iterated.
        2. length > 1, it will iterate thru expr[0]
        3. length == 0 or expr is null, null is returned
      Since:
        8.0.0

    - #### getInstance

          public static ForEach getInstance​(EvaluatorRef evalr,
                                            Component comp,
                                            java.lang.String expr,
                                            java.lang.String begin,
                                            java.lang.String end)

      Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.
      Parameters:
        `expr` - an EL expression that shall return a collection of objects.
      See Also:
        `getInstance(EvaluatorRef, Component, ExValue[], ExValue, ExValue)`

    - #### getInstance

          public static ForEach getInstance​(EvaluatorRef evalr,
                                            Page page,
                                            java.lang.String expr,
                                            java.lang.String begin,
                                            java.lang.String end)

      Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.
      Parameters:
        `expr` - an EL expression that shall return a collection of objects.
      Since:
        3.0.0
      See Also:
        `getInstance(EvaluatorRef, Page, ExValue[], ExValue, ExValue)`

    - #### next

          public boolean next()

      Description copied from interface: `ForEach`
      Advanced to the next element.
      Specified by:
        `next` in interface `ForEach`
      Returns:
        false if there is no more element.