A list is an ordered collection. A list may contain duplicate elements.

This diagram shows the classes and interfaces relevant to list collections in the Progress.Collections framework.
This table describes the classes and interfaces specific to lists (for collection-specific descriptions, see Collections in object-oriented ABL):
Class or interface Description
Progress.Collections.ListIterator<T> class This class represents the type of object returned by the GetIterator() method on a List<T> class and allows the traversal of elements in the list. Properties and methods include Current, MoveNext(), and Reset().
Progress.Collections.IList<T> interface This interface defines the model for a list-based collection. List collections implement a one-based indexing of elements where the elements in the collection can be retrieved by using the index of the element within the collection. Iteration of the collection is performed in the indexed order of the elements (1..2..3..). Elements in the list may be duplicated. Methods include Get(), IndexOf(), Insert(), RemoveAt() and Set().
Progress.Collections.List<T> class This class represents a strongly-typed list of objects that can be accessed by index and provides methods to search and manipulate lists. Properties and methods include Add(), AddAll(), Clear(), Contains(), Count, Get(), GetIterator(), IndexOf(), Insert(), IsEmpty, Remove(), RemoveAt(), and Set().

Serialization and remote parameter passing

A list collection object can be serialized using the present forms of serialization, which include binary and JSON serialization, via the built-in Progress.IO.BinarySerializer and Progress.IO.JsonSerializer, respectively.

You can also pass such list collection objects to, or from, a Progress Application Server (PAS) for OpenEdge remote call.

Serialization and remote parameter passing for object-oriented ABL objects require that all objects are marked as SERIALIZABLE, therefore, the objects inside the list collection also need to be SERIALIZABLE, otherwise an error is raised during object serialization.

Example: List collection with a concrete type

This example code demonstrates how to create a list collection using a concrete class (the OpenEdge.Core.String class). The example also shows how to add, insert, retrieve, replace, and remove elements, and iterate over the list.

USING Progress.Collections.List.
USING Progress.Collections.IIterator.
USING OpenEdge.Core.String.

VAR String myString.
VAR List<String> myList.
VAR IIterator<String> myIterator.

myList = NEW List<String>().

myString = NEW String("four").

// Add items
myList:Add(myString).

myList:Add(NEW String("three")).

// Insert item at the first position
myList:Insert(1, NEW String("one")).

// Get the first item
myString = myList:Get(1).
MESSAGE "First Item:" myString:ToString().

// Replace the second item on the list
myList:SET(2, NEW String("two")).
myString = myList:Get(2).
MESSAGE "Second item:" myString:ToString().

// Remove first item
myList:RemoveAt(1).

// Print out the number of items
MESSAGE "Count:" myList:Count.

// List all items on the list via an iterator
myIterator = myList:GetIterator().
MESSAGE "List Items using iterator".

REPEAT WHILE myIterator:MoveNext():
    MESSAGE myIterator:Current:ToString().
END.

Example: List collection with an interface type

This example code demonstrates how to create and add elements to a list collection using an interface type. This example assumes an interface called IAnimal and two classes, Dog and Cat.

USING Progress.Collections.List.

VAR List<IAnimal> myList.
VAR Dog myDog.
VAR Cat myCat.

myList = NEW List<IAnimal>().

myDog = NEW Dog().
myCat = NEW Cat().

myList:Add(myDog).
myList:Add(myCat).