加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Scala中的基本集合类型是什么?

发布时间:2020-12-16 09:01:56 所属栏目:安全 来源:网络整理
导读:或者换句话说等价于C#IEnumerable T在 Scala?我以为是Seq [T],但是我已经发现,HashMap没有实现这一点,所以不可能. 那是什么呢 解决方法 可扩展和可迭代是Scala集合的基本特征.实际上,Iterable扩展了可扩展性. 来自scala api doc for Iterable: A base trai
或者换句话说等价于C#IEnumerable< T>在 Scala?我以为是Seq [T],但是我已经发现,HashMap没有实现这一点,所以不可能.

那是什么呢

解决方法

可扩展和可迭代是Scala集合的基本特征.实际上,Iterable扩展了可扩展性.

来自scala api doc for Iterable:

A base trait for iterable collections.

This is a base trait for all Scala collections that define an iterator
method to step through one-by-one the collection’s elements.

可延伸:

This is a base trait of all kinds of Scala collections. It implements
the behavior common to all collections,in terms of a method
foreach.

这里有一个很好的图片,从scala-lang site代表scala集合层次结构(分别是mutable和immutable):

一成不变的:

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读