sortDependencies

fun <T> sortDependencies(collection: Collection<T>, dependenciesMapper: (T) -> Set<T>): List<T>


fun <T> sortDependencies(collection: Collection<T>, beforeThisMapper: (T) -> Set<T>, afterThisMapper: (T) -> Set<T>): List<T>

Sorts the given collection by their beforeThisMapper and afterThisMapper properties.

Parameters

collection

The collection to sort.

beforeThisMapper

A function that returns a set of elements that should be before the given element.

afterThisMapper

A function that returns a set of elements that should be after the given element.

Throws

If the collection contains a circular dependency.