Implement in Delphi 7 or compatible, a simple non-visual class called TEmailList that can be used to store email addresses.
The class must store the data (i.e. the email addresses) in a memory efficient way, allowing the storage of millions of email addresses with minimal use of RAM. The class must be able to hold in memory 1 000 000 email addresses using at most 10 MB of memory. For reference: loading this amount of data in a simple TStringList would use about 33 MB of memory. To achieve this, the data must be stored in some kind of tree structure, which will eliminate the need to store duplicating character patterns.
The TEmailList must have the following public functions:
Notes: It must be possible only to add unique email addresses to the storage, in case AddEmail is called for email address that already exists in the storage, the AddEmail call must return false. The SaveToFile saves the currently stored email addresses to a given filename in a format of one email address per line. The LoadFromFile loads the email addresses from a file, the file is in one email per line format. The SaveToFile and LoadFromFile functions must support an optional EncryptionKey parameter, if given, the data is saved to disk / read from disk, in encrypted form. The encryption can be implemented using any lightweight encryption library or by implementing some simple encryption algorithm such as RC4. If the data is saved / read in encrypted format, then the file format is naturally not the one email per line format.
Please do not offer solution in any other programming language than Delphi.