Libraries.Containers.Support.ListIterator Documentation

The ListIterator class for Lists, enables iteration for the list data structure.

Example Code

use Libraries.Containers.List
use Libraries.Containers.Blueprints.ListIterator

class Main
    action main
        List<integer> myList
        ListIterator<List<integer>> listIt = myList:GetIterator()
    end
end

Inherits from: Libraries.Language.Object, Libraries.Containers.Iterator

Summary

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetCurrent()This action gets the current item in the iteration without continuing the iteration.
GetHashCode()This action gets the hash code for an object.
GetList()This action gets the list that the iterator has.
HasNext()This action determines if there is a next item in the iteration.
Next()This action get the next item in the iteration.
Rewind()This action starts the iteration over from the beginning.
Set(Type t)This action sets the value of the current point in the list.
Set(Libraries.Containers.List<Type> newList, Libraries.Containers.Support.ListNode<Type> newHead, Libraries.Containers.Support.ListNode<Type> newTail)This action sets the list parameters up for the iterator.

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: The Compare result, Smaller, Equal, or Larger.

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

GetCurrent()

This action gets the current item in the iteration without continuing the iteration.

Example Code

use Libraries.Containers.List
        use Libraries.Containers.Iterator
        List<integer> myList
        Iterator<integer> listIterator = myList:GetIterator()
        integer item = listIterator:GetCurrent()

Return

Libraries.Language.Object: The current item in the iteration.

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetList()

This action gets the list that the iterator has.

Example Code

use Libraries.Containers.List
        use Libraries.Containers.Support.ListIterator
        ListIterator<List<integer>> listIterator 
        listIterator:GetList()

Return

Libraries.Containers.List: The list.

HasNext()

This action determines if there is a next item in the iteration. It returns true if there is a next and false if there is not.

Example Code

use Libraries.Containers.List
        use Libraries.Containers.Iterator
        List<integer> myList
        Iterator<integer> listIterator = myList:GetIterator()
        
        if listIterator:HasNext()
            listIterator:Next()
        end

Return

boolean: True if there is a next in the iteration and false if there is not.

Next()

This action get the next item in the iteration.

Example Code

use Libraries.Containers.List
        use Libraries.Containers.Iterator
        List<integer> myList
        Iterator<integer> listIterator = myList:GetIterator()
        integer item = listIterator:Next()

Return

Libraries.Language.Object: The next item in the iteration.

Rewind()

This action starts the iteration over from the beginning.

Example Code

use Libraries.Containers.List
        use Libraries.Containers.Iterator
        List<integer> myList
        Iterator<integer> listIterator = myList:GetIterator()
        
        if listIterator:HasNext()
            listIterator:Next()
        end

        listIterator:Rewind()

Set(Type t)

This action sets the value of the current point in the list. Generally, this action should not be used outside of the Libraries.Containers.List class.

Parameters

Set(Libraries.Containers.List<Type> newList, Libraries.Containers.Support.ListNode<Type> newHead, Libraries.Containers.Support.ListNode<Type> newTail)

This action sets the list parameters up for the iterator.

Example Code

use Libraries.Containers.List
        use Libraries.Containers.Support.ListIterator
        use Libraries.Containers.Support.ListNode
        List<integer> myList
        ListNode<integer> head
        ListNode<integer> tail
        ListIterator<List<integer>> listIterator
        listIterator:Set(myList, head, tail)

Parameters