I know how to programmatically add contacts to a contact list, either through the contact itself, or through the List Manager API:
xContact.SetListSubscriptionsFacet(xConnectClient, listId);
Source: https://www.brimit.com/blog/sitecore-9-list-manager-changes
var subscriptionService = serviceLocator.ServiceProvider.GetService<ISubscriptionService>();
subscriptionService.Subscribe(contactListId, contactId);
But none of these services have anything on how to programmatically create a list. I can probably do it a dirty way by manually adding an item to /sitecore/system/Marketing Control Panel/Contact Lists
(based on Contact List
template), but if Sitecore needs to do some indexing or other things when creating lists, this will of course not be enough.
So how can I programmatically create a contact list?
Sitecore 9.0.2 (rev. 180604)