迫于摸鱼瞎想,大家是代码折行时.放在哪行
b()
还是
a
.b()
?
摸鱼中,想了解下
摸鱼中,想了解下
一般来说,在 java 里,steam 流用到这个的场景比较多,或者 signature 比较长的场景会这样做
除了上面的 go,用 IDE 应该都这种形式吧,毕竟”.”会触发方法提示,在触发方法提示的时候敲个回车不是为难自己么
JDK: https://github.com/openjdk/jdk/blob/master/test/langtools/tools/javac/modules/UpgradeModulePathTest.java#L50
dotnet:
https://github.com/dotnet/runtime/blob/master/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Internal/HostTests.cs#L28
go:
https://github.com/google/pprof/blob/master/internal/driver/webhtml.go#L1329
新增 .c() 的时候只有一行 diff
第二行多点空格
Java 的 Stream 流、Builder 模式中比较常见。
a
.b()
很多开源的都是按照这样写的,然后我也用
其实跟多 a.b(c-{
})
table.render({
elem: ‘#demo’
,height: 312
,url: ‘/demo/table/user/’ //数据接口
,page: true //开启分页
,cols: [[ //表头
{field: ‘id’, title: ‘ID’, width:80, sort: true, fixed: ‘left’}
,{field: ‘username’, title: ‘用户名’, width:80}
,{field: ‘sex’, title: ‘性别’, width:80, sort: true}
,{field: ‘city’, title: ‘城市’, width:80}
,{field: ‘sign’, title: ‘签名’, width: 177}
,{field: ‘experience’, title: ‘积分’, width: 80, sort: true}
,{field: ‘score’, title: ‘评分’, width: 80, sort: true}
,{field: ‘classify’, title: ‘职业’, width: 80}
,{field: ‘wealth’, title: ‘财富’, width: 135, sort: true}
]]
});