Skip to content
Snippets Groups Projects
Commit bce30ba3 authored by Duncan McGregor's avatar Duncan McGregor
Browse files

Use List in place of Array

parent 054a7e18
No related branches found
No related tags found
No related merge requests found
package com.gildedrose
class GildedRose(var items: Array<Item>) {
class GildedRose(var items: List<Item>) {
fun updateQuality() {
for (i in items.indices) {
......
......@@ -7,7 +7,7 @@ internal class GildedRoseTest {
@Test
fun foo() {
val items = arrayOf<Item>(Item("foo", 0, 0))
val items = listOf(Item("foo", 0, 0))
val app = GildedRose(items)
app.updateQuality()
assertEquals("fixme", app.items[0].name)
......
......@@ -4,7 +4,7 @@ fun main(args: Array<String>) {
println("OMGHAI!")
val items = arrayOf(Item("+5 Dexterity Vest", 10, 20), //
val items = listOf(Item("+5 Dexterity Vest", 10, 20), //
Item("Aged Brie", 2, 0), //
Item("Elixir of the Mongoose", 5, 7), //
Item("Sulfuras, Hand of Ragnaros", 0, 80), //
......@@ -31,6 +31,4 @@ fun main(args: Array<String>) {
println()
app.updateQuality()
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment