Kotlin แยกรายการแบบอ่านอย่างเดียวจาก MutableList ในระดับประเภท java.util.List ของ Java นั้นสามารถเปลี่ยนแปลงได้เสมอผ่านอินเทอร์เฟซ — wrappers ที่ไม่สามารถแก้ไขได้และวิธีการจากโรงงานจะเพิ่มระเบียบวินัย เรื่องเดียวกันสำหรับ mapOf กับ Map.of การจัดกลุ่มความแตกต่างเหล่านี้จะบอกคุณว่าเมื่อใดที่การเปลี่ยนแปลงไม่ได้คือสัญญาระหว่างการคอมไพล์เทียบกับตัวตัดคำรันไทม์

Kotlin: listOf เทียบกับ mutableListOf
Full content is available with a subscription.
Get full access to all courses on the platform for one year with a single payment.
Unlike other platforms that charge per course, here you get everything for one price, and after one year of use there will be no automatic charge for the following year.