TemplateCollectionModelEx (FreeMarker 2.3.23 API)
Date: 2015-07-05

freemarker.template

## Interface TemplateCollectionModelEx

- All Superinterfaces:
    TemplateCollectionModel, TemplateModel
  All Known Implementing Classes:
    DefaultNonListCollectionAdapter

      public interface TemplateCollectionModelEx
      extends TemplateCollectionModel

  Experimental - subject to change: "extended collection" template language data type: Adds size/emptiness querybility and "contains" test to `TemplateCollectionModel`. The added extra operations is provided by all Java `Collection`-s, and this interface was added to make that accessible for templates too.

  Experimental status warning: This interface is subject to change on non-backward compatible ways, hence, it shouldn't be implemented outside FreeMarker yet.

  Since:
    2.3.22

- - ### Field Summary

    - ### Fields inherited from interface freemarker.template.TemplateModel

      `NOTHING`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `contains(TemplateModel item)` Tells if a given value occurs in the collection, accodring the rules of the wrapped collection.
    `boolean` | `isEmpty()` Returns if the collection contains any elements.
    `int` | `size()` Returns the number items in this collection, or `Integer.MAX_VALUE`, if there are more than `Integer.MAX_VALUE` items.

    - ### Methods inherited from interface freemarker.template.TemplateCollectionModel

      `iterator`

- - ### Method Detail

    - #### size

          int size()
            throws TemplateModelException

      Returns the number items in this collection, or `Integer.MAX_VALUE`, if there are more than `Integer.MAX_VALUE` items.
      Throws:
        `TemplateModelException`

    - #### isEmpty

          boolean isEmpty()
                   throws TemplateModelException

      Returns if the collection contains any elements. This differs from `size() != 0` only in that the exact number of items need not be calculated.
      Throws:
        `TemplateModelException`

    - #### contains

          boolean contains(TemplateModel item)
                    throws TemplateModelException

      Tells if a given value occurs in the collection, accodring the rules of the wrapped collection. As of 2.3.22, this interface is not yet utilized by FTL, and certainly it won't be earlier than 2.4.0. The usefulness of this method is questionable, as the equality rules of Java differs from that of FTL, hence, calling this won't be equivalent with `?seq_contains(e)`.
      Throws:
        `TemplateModelException`