or make a factory and hide the constructor: ``` d...
# announcements
a
or make a factory and hide the constructor:
Copy code
data class ViewportInfo private constructor (val channelIds: List<String>, val startTime: Long, val duration: Long) {
    companion object {
        @JvmStatic fun create(channelIds: List<String>?, startTime: Long, duration: Long): ViewportInfo {
            return ViewportInfo(channelIds ?: emptyList(), startTime, duration)
        }
    }
}

// from java:

ViewportInfo something = ViewportInfo.create(null, 10, 1);