![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
kotlin
healthLau
他们坐在特快列车里,却不知道他们要追寻什么。所以他们很烦躁,不停地绕圈子......
展开
-
Kotlin apply、with、let、run、also的使用
apply 与 withfun main() { val list = mutableListOf(1, 2, 3, 4, 5, 6) println(list.apply { this.add(111) 111 }) //apply:返回被设置后的它自己 println(with(list) { this.add(222) 222 }) //apply:返回被设置后的最后一行 p.原创 2021-07-14 17:11:10 · 293 阅读 · 0 评论 -
Kotlin-Stream01
//声明数据类data class Apple(var id: Int?, var name: String?, var money: BigDecimal?, var num: Int?) { constructor() : this(null, null, null, null) fun getMe() = this fun getMoney() = money!!.toDouble()}fun main() { val appleList = Array...原创 2021-07-02 18:29:24 · 282 阅读 · 2 评论 -
Kotlin各种时间函数
时间戳/* 时间戳*///获取当前时间戳timestamp() //1625209297timestamp().toDateString() //2021-07-02 13:54:29//获取当前天开始的时间戳 LocalDateTime.of(LocalDate.now(),LocalTime.MIN).atZone(ZoneId.systemDefault()).toEpochSecond() //1625155200LocalDateTime.of(Loc原创 2021-07-02 15:08:14 · 10324 阅读 · 0 评论