简体   繁体   English

Scala案例类是否有Map支持?

[英]Is Scala case class backed by a Map?

Scala case classes essentially capture a set of fields with helping methods. Scala 案例类实质上是使用帮助方法来捕获一组字段的。 How are case classes resolved? 案例类如何解决? Are they expanded to different classes with fields or a generic class that contains, say, a HashMap<String, Field> ? 它们是否扩展到具有字段的通用类或包含HashMap<String, Field>的通用类?

If it's the latter, are case classes with single field more expensive than explicitly defined data objects? 如果是后者,具有单个字段的案例类是否比显式定义的数据对象贵?

Case classes are exactly the same as regular classes, except that they offer some additional convenience functions. 案例类与常规类完全相同,不同之处在于它们提供了一些附加的便利功能。 No, they are not backed by a map. 不,它们没有地图支持。 What made you think that they are? 是什么让您认为它们是?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM