NAME
TStringCollection - sorted collection specialized for strings
HIERARCHY
TObject
TCollection
TSortedCollection
TStringCollection
SYNOPSIS
use TUI::Objects;
my $coll = TStringCollection->new(
limit => 100,
delta => 20
);
$coll->insert("alpha");
$coll->insert("beta");
DESCRIPTION
TStringCollection is a specialized variant of TSortedCollection designed for storing and managing collections of strings. It provides a ready-to-use implementation that maintains its elements in sorted order using string comparison semantics.
Unlike its base class, TStringCollection supplies concrete implementations for key extraction, comparison, and item management. This allows string data to be stored, sorted, and serialized without requiring subclasses to override any behavior.
Apart from its string-specific functionality, all collection management features are inherited unchanged from TSortedCollection.
CONSTRUCTOR
new
my $coll = TStringCollection->new(
limit => $limit,
delta => $delta
);
Creates a new string collection with the specified initial capacity and growth policy.
- limit
-
Initial capacity of the collection (Int).
- delta
-
Growth increment of the collection (Int). A value of zero disables automatic growth.
new_TStringCollection
my $coll = new_TStringCollection($limit, $delta);
Factory-style constructor using positional arguments.
This constructor is equivalent to calling new with named parameters and is provided for compatibility with traditional Turbo Vision construction patterns.
METHODS
compare
my $cmp = $coll->compare($key1, $key2);
Compares two keys as strings and returns an integer indicating their relative order.
The return value follows the standard convention:
negative value if
$key1is less than$key2zero if both strings are equal
positive value if
$key1is greater than$key2
SEE ALSO
TSortedCollection, TCollection
AUTHORS
- Borland International (original Turbo Vision design)
- J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)
COPYRIGHT AND LICENSE
Copyright (c) 1990-1994, 1997 by Borland International
Copyright (c) 2026 the "AUTHORS" as listed above.
This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).