EvenAllocator

Allocates a Money in equal parts. Example:

val money = 100 money "USD"
val allocator = EvenAllocator.default()

allocator.allocate(money, 3).result() // [USD 33.34, USD 33.33, USD 33.33]

Parameters

differenceAllocator

Strategy to allocate the difference generated when allocating a Money amount.

Constructors

Link copied to clipboard
constructor(differenceAllocator: DifferenceAllocation)

Types

Link copied to clipboard
object Factory

A EvenAllocator factory.

Functions

Link copied to clipboard
abstract fun allocate(money: Money, by: EvenParts): Result

Allocates a Money.

open fun allocate(money: Money, parts: Int): Result

Allocates a Money amount in even parts.