List collections in object-oriented ABL
- Last Updated: March 21, 2022
- 3 minute read
- OpenEdge
- Version 13.0
- Documentation
A list is an ordered collection. A list may contain duplicate elements.
Progress.Collections framework.
| 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.
|
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.
|