Is that conceptually a good use of a data class? I’ve written them with methods in them but typically limit the methods to adding extra meaning to the data like isExpired or fullName methods/properties.
z
ziad
01/05/2018, 5:45 PM
Would you rather just expose the underlying data structure (so a public map in this case), and have consumers of the data class read it directly?
y
yole
01/05/2018, 5:57 PM
I wouldn’t. encapsulating the underlying data structure is always a good idea