Idioms Random and frequently used in kotlin. Creating Data classes in kotlin (POJOs/DTOs) Data classes are model classes which are created to hold data. In Java, we usually create POJO classes with getter and setter methods for each member variable of a class. But in Kotlin, POJO class can be created within a single line of code with keywords: 'data', 'class', 'class name' and its member variables. data class Student( val name: String, val age: Int) provides a Student class with the following functionality: - getters(and setters in case of vars) for all properties - equals() - hashCode() - toString() - copy() - object1(), object2(), ..., for all properties. Filter a list in kotlin There are several ways to filter a list in kotlin. For example: val fruits = listOf ("Apple", "Banana", "Orange") ...
TechByteFlow is all about technology mainly focus on programming-related posts.