refactor(mingli-utils):重构集合工具类并添加新功能
- 重写 Collection 类,使用 Kotlin 语法和特性优化代码结构 - 添加新方法以支持数组和集合之间的转换 - 新增 CopyOnWriteArrayList、Stack 和 TreeSet 相关方法 -优化现有方法,提高代码可读性和性能 - 删除未使用的 ForEach 导入 -调整 build.gradle.kts 中的依赖项
This commit is contained in:
@@ -16,14 +16,13 @@
|
||||
* ProjectName mingli-utils
|
||||
* ModuleName mingli-utils.main
|
||||
* CurrentFile RandomBytes.kt
|
||||
* LastUpdate 2025-09-12 17:11:19
|
||||
* LastUpdate 2025-09-15 00:08:18
|
||||
* UpdateUser MingLiPro
|
||||
*/
|
||||
@file:JvmName("RandomBytes")
|
||||
|
||||
package com.mingliqiye.utils.random
|
||||
|
||||
import com.mingliqiye.utils.collection.ForEach
|
||||
import com.mingliqiye.utils.iterator.Range
|
||||
|
||||
/**
|
||||
@@ -33,9 +32,7 @@ import com.mingliqiye.utils.iterator.Range
|
||||
*/
|
||||
fun randomBytes(length: Int): ByteArray {
|
||||
val bytes = ByteArray(length)
|
||||
ForEach.forEach(
|
||||
Range(0, length - 1)
|
||||
) { i: Int -> bytes[i] = randomByte(0x00.toByte(), 0xff.toByte()) }
|
||||
Range(0, length - 1).forEach { i: Int -> bytes[i] = randomByte(0x00.toByte(), 0xff.toByte()) }
|
||||
return bytes
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user