com.marklogic.xcc.types

## Interface XdmSequence<I extends XdmItem>

- All Superinterfaces:
    XdmValue
  All Known Subinterfaces:
    ResultSequence

      public interface XdmSequence<I extends XdmItem>
      extends XdmValue

  A `XdmValue` which is a sequence of Items.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `asString()` This method is equivalent to `asString ("\n")`.
    `java.lang.String` | `asString(java.lang.String separator)` Returns a String comprised of `XdmValue.asString()` value of each item in the sequence with the given separator string between each.
    `java.lang.String[]` | `asStrings()` Returns an array of `String`s, each of which is the value returned by the `XdmValue.asString()` method for each item in the sequence.
    `boolean` | `isEmpty()` Indicates whether this XdmSequence is empty.
    `XdmItem` | `itemAt(int index)` Return the `XdmItem` at the given position from this XdmSequence.
    `java.util.Iterator<I>` | `iterator()` A java.util.Iterator instance that iterates over the items in this XdmSequence.
    `int` | `size()` Returns the size of this XdmSequence.
    `XdmItem[]` | `toArray()` Construct an array of `XdmItem`s from this `XdmSequence`.
    `java.lang.String` | `toString()` Return a textual description of this XdmSequence object, NOT the value of the items in the sequence.

    - ### Methods inherited from interface com.marklogic.xcc.types.XdmValue

      `getValueType`

- - ### Method Detail

    - #### size

          int size()

      Returns the size of this XdmSequence.
      Returns:
        The number of Items (possibly zero) in this sequence.

    - #### isEmpty

          boolean isEmpty()

      Indicates whether this XdmSequence is empty.
      Returns:
        true if size() == 0.

    - #### toArray

          XdmItem[] toArray()

      Construct an array of `XdmItem`s from this `XdmSequence`.
      Returns:
        An array of `XdmItem`, possibly zero-length.

    - #### itemAt

          XdmItem itemAt(int index)

      Return the `XdmItem` at the given position from this XdmSequence.
      Parameters:
        `index` - The index of the `XdmItem` (zero-based) to return.
      Returns:
        An `XdmItem` instance.
      Throws:
        `java.lang.IllegalArgumentException` - If index is negative or is greater than or equal to `size()`.

    - #### iterator

          java.util.Iterator<I> iterator()

      A java.util.Iterator instance that iterates over the items in this XdmSequence.
      Returns:
        An Iterator over the `XdmItem` instances in this XdmSequence.

    - #### asString

          java.lang.String asString(java.lang.String separator)

      Returns a String comprised of `XdmValue.asString()` value of each item in the sequence with the given separator string between each. If the sequence is empty (`isEmpty()` is true) then the empty string is returned.
      Parameters:
        `separator` - A separator string, such as "\n", to be inserted between the `XdmValue.asString()` value of each item in the sequence. A value of null is equivalent to the empty string which causes all items to be concatenated with no separator.
      Returns:
        A string representation of the sequence.

    - #### asString

          java.lang.String asString()

      This method is equivalent to `asString ("\n")`.
      Specified by:
        `asString` in interface `XdmValue`
      Returns:
        A string representation of the sequence with a newline separator.

    - #### asStrings

          java.lang.String[] asStrings()

      Returns an array of `String`s, each of which is the value returned by the `XdmValue.asString()` method for each item in the sequence.
      Returns:
        An array of `String`s.

    - #### toString

          java.lang.String toString()

      Return a textual description of this XdmSequence object, NOT the value of the items in the sequence. Use the `asString()` or `asStrings()` methods to obtain `String` representations of the item values.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        A textual description of this object, appropriate for use in a debug or log message.
      See Also:
        `asString()`, `asStrings()`

Copyright © 2025 MarkLogic Corporation

Complete online documentation for MarkLogic Server, XQuery and related components may be found at docs.progress.com