... 一件事值得注意:先前如果你取出(unbox)Null值它将变为0次源代码中编译器将自动地转换Integer为int然后加上10接着将其转换回Integer. 类型安全枚举(Typesafeenums) 静态导入(Static import) ...
基于12个网页-相关网页
这是Scala中的一个常见的特色,它可以提供更简单、更类型安全的枚举方式。
This is a common idiom in Scala to provide a simpler, more type-safe way of doing enumerations.
为了提高类型安全性,这也可以是一个枚举。
地图和枚举是完全不同的数据结构。地图是将值与关键。为使类型安全的枚举常数。比较是不可能的!
Maps and enums are completely different data structures. Maps are for associating a value with a key. Enums are for make typesafe constants. Comparing the two is impossible!
应用推荐