Eclipse Collections-您的集合需要的功能⚡️

是否否认数据结构很重要。 选择正确的程序将极大地提高程序/产品/应用程序的性能。

集合库随附了许多(主流)编程语言。 它提供了API和实现,使最终用户可以轻松实现。

这些实施速度很快,并且构建起来使最终用户更容易使用。

提供太多的选择会增加语言的学习曲线,提供的选择太多会导致用户执行繁琐。 因此,语言在提供内容时必须非常小心。

Eclipse collections provide optimized and efficient implementations of collections in Java.

Eclipse集合还添加了一些其他的数据结构,这些数据结构在Java核心中本身不可用。

但是最重​​要的是,Eclipse-Collections提供了可以使用的优雅,功能强大且流畅的API。

我喜欢Eclipse系列的主要原因如下:

  • APIs are awesome. They are:功能性懒平行渴望(虽然经过优化)同时提供一成不变的和易变的馆藏provide highly optimized和memory-efficient implementation

Set things up

如果您使用的是马文项目包括蚀集合依赖项如下:

<dependency
    <groupId>org.eclipse.collections</groupId>
    <artifactId>eclipse-collections</artifactId>
    <version>10.0.0</version>
</dependency>

如果您正在使用摇篮然后将其导入:

compile 'org.eclipse.collections:eclipse-collections-api:10.0.0'
compile 'org.eclipse.collections:eclipse-collections:10.0.0'

Ingredients

Eclipse集合包含以下数据结构:

  1. 清单组地图Bi地图Multi地图袋堆配对和其他

所有这些数据结构包括以下实现:

  1. 可变的一成不变的懒平行已订购已排序固定原始和其他
注意并非所有集合的所有实现。

Code, Code, Code...

There are few excellent code katas available. They are here.

让我们从一个开始清单。

要实例化新的可变列表,我们可以执行以下操作:

MutableList<Integer> firstTenNumbers = Lists.mutable.with(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);

您可以使用实例化列表的。

MutableList<Integer> firstTenNumbers = Lists.mutable.of(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);

Reterival

我们可以使用经典的检索元素获取(索引)办法。 Eclipse Collections还提供了一个getFirst()和getLast() method to retrieve the first和the last elements respectively.

firstTenNumbers.get(4);       // 4
firstTenNumbers.getFirst();  // 0
firstTenNumbers.getLast();  // 9

在功能范式中,采取|采取While|下降|下降While APIs are awesome because they help to 采取 and 下降 certain elements from the list without mutating them。 With Eclipse Collections we can do that in 爪哇。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值