当前位置:网站首页>Infix keyword infix expression and the use of generic extension function in kotlin
Infix keyword infix expression and the use of generic extension function in kotlin
2022-07-07 08:14:00 【yu-Knight】
// Conditions for a : The first parameter is T.go Function extension
// Condition 2 : Need to be in parentheses (r:R) Pass a parameter in the parameter
private infix fun <T, R> T.go(r: R) {
println(" Infix expression , The content of the first parameter is :$this")
println(" Infix expression , The content of the second parameter is :$r")
}
fun main(){
//map Infix expression in
mapOf("map1" to 1)
mapOf("map2" to 2)
mapOf("map3" to 3)
// Infix expression written by myself
123 go "String"
"yuknight" go "kotlin"
}
边栏推荐
- 【雅思口语】安娜口语学习记录 Part3
- Hisense TV starts the developer mode
- ROS bridge notes (05) - Carla_ ackermann_ Control function package (convert Ackermann messages into carlaegovehiclecontrol messages)
- 【数字IC验证快速入门】13、SystemVerilog interface 和 program 学习
- LeetCode简单题之判断一个数的数字计数是否等于数位的值
- eBPF Cilium实战(1) - 基于团队的网络隔离
- OpenJudge NOI 2.1 1752:鸡兔同笼
- Pytoch (VI) -- model tuning tricks
- Complex network modeling (III)
- 海信电视开启开发者模式
猜你喜欢
【数字IC验证快速入门】13、SystemVerilog interface 和 program 学习
让Livelink初始Pose与动捕演员一致
Lua 编程学习笔记
Fast parsing intranet penetration escorts the document encryption industry
Don't stop chasing the wind and the moon. Spring mountain is at the end of Pingwu
The zblog plug-in supports the plug-in pushed by Baidu Sogou 360
Complex network modeling (I)
拓维信息使用 Rainbond 的云原生落地实践
Qinglong panel - today's headlines
Jmeter 的使用
随机推荐
Find the mode in the binary search tree (use medium order traversal as an ordered array)
Summary of redis functions
JS quick start (I)
利用 Helm 在各类 Kubernetes 中安装 Rainbond
Hisense TV starts the developer mode
Quick analysis of Intranet penetration helps the foreign trade management industry cope with a variety of challenges
Qinglong panel - today's headlines
拓维信息使用 Rainbond 的云原生落地实践
Notes on PHP penetration test topics
在Rainbond中一键部署高可用 EMQX 集群
Minimum absolute difference of binary search tree (use medium order traversal as an ordered array)
【数字IC验证快速入门】13、SystemVerilog interface 和 program 学习
船载雷达天线滑环的使用
Battery and motor technology have received great attention, but electric control technology is rarely mentioned?
Interactive book delivery - signed version of Oracle DBA work notes
Vulnerability recurrence easy_ tornado
The zblog plug-in supports the plug-in pushed by Baidu Sogou 360
复杂网络建模(二)
Zcmu--1396: queue problem (2)
[untitled]