feat(collection): auto assignment id to new Product in CollectonManager

This commit is contained in:
2026-03-01 03:47:03 +03:00
parent 0c03114005
commit 966e819a4a

View File

@@ -8,9 +8,12 @@ class CollectionManager(
private val io: IOHandler,
) {
private val list = LinkedList<Product>()
private var currId = 1L
fun addProduct(product: Product) {
list.add(product)
val productWithId = product.copy(id = currId)
list.add(productWithId)
currId++
io.println(list.toString())
}
}