Kotlin, Programming, Software Development, Functional Programming, Coding.
list remains immutable. data class Order(val orderId: Int, val product: String, val price: Double) // Suppose we fetch this from a database or an API val userOrders: List<Order> = fetchOrdersFromDatabase() // If we later want to give a discount, instead of modifying the original list, // we create