Class ContainerIterator<T>Abstract

Type Parameters

  • T

Hierarchy

Properties

Methods

Accessors

Properties

container: Container<T>

Description

The container pointed to by the iterator.

iteratorType: IteratorType

Description

Iterator's type.

Example

console.log(container.end().iteratorType === IteratorType.NORMAL);  // true

Methods

  • Description

    Move this iterator to pre.

    Returns

    The iterator's self.

    Example

    const iter = container.find(1);  // container = [0, 1]
    const pre = iter.pre();
    console.log(pre === iter); // true
    console.log(pre.equals(iter)); // true
    console.log(pre.pointer, iter.pointer); // 0, 0

    Returns ContainerIterator<T>

  • Description

    Move this iterator to next.

    Returns

    The iterator's self.

    Example

    const iter = container.find(1);  // container = [1, 2]
    const next = iter.next();
    console.log(next === iter); // true
    console.log(next.equals(iter)); // true
    console.log(next.pointer, iter.pointer); // 2, 2

    Returns ContainerIterator<T>

  • Description

    Get a copy of itself.

    Returns

    The copy of self.

    Example

    const iter = container.find(1);  // container = [1, 2]
    const next = iter.copy().next();
    console.log(next === iter); // false
    console.log(next.equals(iter)); // false
    console.log(next.pointer, iter.pointer); // 2, 1

    Returns ContainerIterator<T>

Accessors

  • get pointer(): T
  • Description

    Pointers to element.

    Returns

    The value of the pointer's element.

    Example

    const val = container.begin().pointer;
    

    Returns T

  • set pointer(newValue: T): void
  • Description

    Set pointer's value (some containers are unavailable).

    Example

    (<LinkList<number>>container).begin().pointer = 1;
    

    Parameters

    • newValue: T

      The new value you want to set.

    Returns void

Generated using TypeDoc