Represents a strongly-typed list of objects that can be accessed by index. Provides methods to search and manipulate lists.

This class is FINAL and cannot be extended.

Serializable:

Yes

Constructor(s)

List()

List(initialCapacity)
initialCapacity
An INTEGER value that specifies the initial capacity for the list. OpenEdge automatically maintains the size of the list, extending it as elements are added to it. For performance reasons, you may specify an initial capacity, if that is known at the time the list is created, to avoid the cost of constantly expanding the capacity of the list.

The default initial capacity for a list is 10 elements.

Super Class

Progress.Lang.Object class

Interfaces

Progress.Collections.IList<T> interface

Public Properties

Count property (Collections) IsEmpty property (Collections)

Public Methods

Add( ) method (Collections) AddAll( ) method (Collections)
Clear( ) method (Collections) Contains( ) method (Collections)
Get( ) method (List Collections) GetIterator( ) method (Collections)
IndexOf( ) method (Collections) Insert( ) method (Collections)
Remove( ) method (Collections) RemoveAt( ) method (Collections)
Set( ) method (Collections)

Example

This example code shows how to create a list, add elements to the list, retrieve elements, replace elements, remove elements, and iterate over the list.

var Progress.Collections.List<President> thelist.
var Progress.Collections.IIterator<President> iterator.
var President president1.
var President president2.

thelist = new Progress.Collections.List<President>().

// Add 3 elements to the list
thelist:Add(new President("George")).
thelist:Add(new President ("John")).
thelist:Add(new President("Thomas")).

// Retrieve the first element from the list
president1 = thelist:Get(1).
message president1:ToString().

// Replace the first element in the list with a fully named president.
thelist:Set(1, new President("George Washington")).
president2 = thelist:Get(1).
message president2:ToString().

// Remove the second president from the list
thelist:RemoveAt(2).

// Print out the number of presidents in the list
message thelist:Count.

// Iterate over the entries in the list
iterator = thelist:GetIterator().
repeat while iterator:MoveNext():
  message iterator:Current:ToString().
end.

Notes

  • The Progress.Collections.List<T> class supports any Progress.Lang.Object or System.Object from .NET.
  • Sequencing of elements in the list is maintained as objects are added, inserted, or removed.
  • The Unknown value (?) may appear any number of times within the list.
  • Duplicate elements are allowed in the list.
  • Elements in the list can be accessed using an INTEGER index. Indexes are one-based.
  • Elements in the list that are explicitly deleted, while still in the list, are treated as the Unknown value (?).
  • Progress.Collections.List<T> does not participate in transactional processing. That is, any changes made to the structure of a List are not backed out if they occur within a transaction that is backed out.
  • The Contains(), Remove(), and IndexOf() methods determine equality of based on invoking Equals(). Those methods call the Equals() method on the object in the list, passing the object being tested against. If Equals() is not overridden by the type supplied as a type argument to List, then the default behavior is to fall back to the built-in implementation (since all Progress Lang.Object’s have an Equals() implementation provided by Progress.Lang.Object). If both the object reference in the collection, and the object being tested are Unknown (?), then the AVM considers the objects equal.
  • For a List<T> object to be considered serializable, the concrete type specified in the type argument must also be serializable. That is, for List<Presidents>, the class type Presidents must also be serializable, if you want to serialize it or pass the list as a parameter in a remote call.

See also

<T> Generic type reference