Skip to content

Add API to manipulate lists in builders #101

@rock3r

Description

@rock3r

If you create a builder — e.g., by using Podcast.builder().applyFrom(Podcast) — you have no way to manipulate its internal list of builders for its items. For example, you can add new episodes (always at the end of the list, after the existing ones) but there's no way to sort them, or filter them, before building.

The only option right now is to build the podcast, hoping it does build, and then use copy to manipulate the items:

val podcast = podcastBuilder.build()?.run {
    // Sort episodes by pubDate, from newest to oldest
    copy(episodes = episodes.sortedByPubDateDescending())
} ?: error("Unable to generate podcast feed")

It's not a very elegant way to do it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions