com.turbomates.event.EventStore.kt Maven / Gradle / Ivy
package com.turbomates.event
import java.util.LinkedList
class EventStore {
private val events: LinkedList = LinkedList()
fun addEvent(event: Event) {
events.push(event)
}
fun raiseEvents(): Sequence = sequence {
while (events.isNotEmpty()) {
yield(events.pop())
}
}
}