Skip to content

Commit

Permalink
Use SortedMap instead of plain Map for lower memory usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
erikrozendaal committed Mar 26, 2011
1 parent ea39037 commit c627546
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion example/src/main/scala/example/reports/InvoiceReport.scala
Expand Up @@ -3,6 +3,7 @@ package example.reports
import com.zilverline.es2._
import com.zilverline.es2.reports.Report
import example.events._
import collection.immutable.SortedMap

case class InvoiceDocument(
invoiceId: Identifier,
Expand All @@ -11,7 +12,7 @@ case class InvoiceDocument(
totalAmount: BigDecimal = 0)

case class InvoiceReport(
private val invoices: Map[Identifier, InvoiceDocument] = Map.empty,
private val invoices: SortedMap[Identifier, InvoiceDocument] = SortedMap.empty,
private val recent: List[Identifier] = Nil) extends Report[InvoiceEvent] {

def mostRecent(n: Int): List[InvoiceDocument] = recent.take(n).map(invoices)
Expand Down

0 comments on commit c627546

Please sign in to comment.