当前位置:网站首页>HashSet to array
HashSet to array
2022-07-24 06:49:00 【cxcaln】
Development process , We often put data into sets for operation , because java Collections provide us with a large number of methods and functions to use , It greatly reduces our development workload . But sometimes what we need is the basic data type , For example, array , At this point, we convert the collection type into an array . Although the collection class has a toArray() Method , But back Object[] type , Usually we can consider using stream Flow forward , The reference codes are as follows :
HashSet<Integer> set = new HashSet();
int[] a = set.stream().mapToInt(Integer::intValue).toArray()
边栏推荐
- 记录PHPSerializer工具类反序列化遇到的坑
- LM393 电压比较器及其典型电路介绍
- [lvgl (1)] a brief introduction to lvgl
- Solution: exit status 1 and exit status 145 appear when the console uses NVM to control the node version
- 实验:LVM逻辑卷的建立、扩容、与删除
- Random forest, lgbm parameter adjustment based on Bayesian Optimization
- Promise
- 【音频解码芯片】VS1503音频解码芯片的应用
- 不运动也能增肌???打一针冬眠黑熊的血清就行
- kubernetes 的Deployment(部署),Service概念,动态扩缩容
猜你喜欢

Neural network superparameter adjustment (based on ray package)
![[esp8266 spot welder] Based on esp8266 for Arduino](/img/9a/81b0d16572116445d46ba4e34a6e4e.png)
[esp8266 spot welder] Based on esp8266 for Arduino

sojson jsjiami.com.v6 爬虫js逆向

File system and log analysis

Kubernetes' deployment, service concept, dynamic capacity expansion

Explain the event cycle mechanism and differences between browser and node in detail

Several common problems of SQL server synchronization database without public IP across network segments

机器学习案例:孕妇吸烟与胎儿健康

【LVGL(2)】LVGL入门,在CodeBlock上进行模拟以及移植STM32

Account and authority management
随机推荐
Promise (try to implement a promise by yourself) more detailed comments and other interfaces are not completed yet. Let's continue next time.
js和ts学习总结
Introduction, architecture and principle of kubernetes
PyQt5入门——学生管理系统
神经网络超参数调整(基于ray包)
Redis入门
Solution: exit status 1 and exit status 145 appear when the console uses NVM to control the node version
Depth first search (template use)
磁盘管理和文件系统
[jQuery自定义插件] 1 自定义缓存插件-jQueryCache
Redis special data type bitmap
Visibility:hidden and display:none
[lvgl (1)] a brief introduction to lvgl
Special effects - click with the mouse and the fireworks will burst
【小型物体测速仪】只有原理,无代码
类加载的过程(生命周期)详情分析
Sort by an attribute value of an object in the array
LM393 电压比较器及其典型电路介绍
Browser local storage
Detailed analysis of the process (life cycle) of class loading