{ "version": "https://jsonfeed.org/version/1", "title": "Kotlin", "description": "", "home_page_url": "go/kotlin", "feed_url": "feed/kotlin.json", "icon": "https://cdn.v2ex.com/navatar/fec8/d47d/982_large.png?m=1585380699", "favicon": "https://cdn.v2ex.com/navatar/fec8/d47d/982_normal.png?m=1585380699", "items": [ { "author": { "url": "member/rcj6056", "name": "rcj6056", "avatar": "https://cdn.v2ex.com/gravatar/0309611f6c86b1a4fc2b7c7f2e970d5a?s=73&d=retro" }, "url": "t/1174840", "title": "compose \u4f7f\u7528\u6027\u80fd\u95ee\u9898", "id": "t/1174840", "date_published": "2025-11-25T02:16:37+00:00", "content_html": "

\u8bf7\u6559\u4e0b \u5728\u7528 compose \u5199\u9875\u9762\u7684\u65f6\u5019\n\u5982\u679c\u9875\u9762\u6bd4\u8f83\u590d\u6742 \u903b\u8f91\u6bd4\u8f83\u591a\n\u5bf9\u6bd4\u4e0b\u7528\u4ee5\u524d xml \u7684\u5199\u6cd5\u6765\u5904\u7406 \u6027\u80fd\u4e0a\u4f1a\u597d\u4e9b\u5417

\n

\u6211\u53ea\u4e86\u89e3\u6bcf\u4e2a view \u90fd\u662f\u4f1a\u8d70\u6d4b\u91cf\u7ed8\u5236\u6d41\u7a0b\u7684\n\u4f46\u662f compose \u8fd9\u79cd\u600e\u4e48\u4f53\u73b0\u51fa\u6765\u7684\n\u6211\u611f\u89c9\u5927\u91cf\u7684 compose \u7ec4\u4ef6\u80af\u5b9a\u4e5f\u4f1a\u5bfc\u81f4\u8fd9\u79cd\u7ed8\u5236\u5361\u987f\u7684\u95ee\u9898\u5427

\n

\u8fd9\u5757\u6ca1\u63a5\u89e6\u8fc7 \u6709\u8001\u54e5\u77e5\u9053\u561b

\n" }, { "author": { "url": "member/rcj6056", "name": "rcj6056", "avatar": "https://cdn.v2ex.com/gravatar/0309611f6c86b1a4fc2b7c7f2e970d5a?s=73&d=retro" }, "url": "t/1171245", "title": "\u6709\u4eba\u5728\u9879\u76ee\u91cc\u9762\u4f7f\u7528 compose \u5f00\u53d1\u5417", "id": "t/1171245", "date_published": "2025-11-07T08:05:36+00:00", "content_html": "

compose + kotlin \u597d\u50cf\u662f\u4e2a\u4e0d\u9519\u7684\u9009\u62e9

\n

\u6709\u8001\u54e5\u5728\u9879\u76ee\u91cc\u9762\u8fd9\u6837\u5f00\u53d1\u5417

\n

\u4f53\u9a8c\u5982\u4f55\uff0c\u6bd4\u4f20\u7edf\u7684 xml \u5f00\u53d1\u6709\u5565\u4f18\u52bf

\n" }, { "author": { "url": "member/rcj6056", "name": "rcj6056", "avatar": "https://cdn.v2ex.com/gravatar/0309611f6c86b1a4fc2b7c7f2e970d5a?s=73&d=retro" }, "url": "t/1170416", "title": "\u5927\u5bb6\u4f1a\u5728\u8001\u9879\u76ee\u4e2d\u4f7f\u7528 kotlin \u5417", "id": "t/1170416", "date_published": "2025-11-04T05:58:54+00:00", "content_html": "

\u6700\u8fd1\u63a5\u89e6\u4e86\u8001\u9879\u76ee \u8fd8\u662f\u51e0\u5e74\u524d\u7684\u6a21\u5f0f mvc\n\u9879\u76ee\u6bd4\u8f83\u7b80\u5355 \u6700\u8fd1\u4e5f\u6709\u65b0\u7684\u9700\u6c42\u52a0\u8fdb\u53bb\n\u6211\u63a5\u6536\u7684\u65f6\u5019\u5728\u60f3\u65b0\u5199\u7684\u4e1c\u897f\u8981\u4e0d\u8981\u7528 kt \u6765\u5199\u5462

\n

\u5927\u5bb6\u600e\u4e48\u770b

\n" }, { "author": { "url": "member/LiYing2016", "name": "LiYing2016", "avatar": "https://cdn.v2ex.com/avatar/53b7/8265/171460_large.png?m=1462193666" }, "url": "t/1148241", "title": "Kotlin \u4e2d\u6587\u6587\u6863 2.2.20 \u7248\u7ffb\u8bd1\u5b8c\u6210\u4e86", "id": "t/1148241", "date_published": "2025-07-28T07:20:35+00:00", "content_html": "

Kotlin \u4e2d\u6587\u6587\u6863\u66f4\u65b0\u5230\u4e86\u6700\u65b0\u7684 2.2.0 \u7248\nhttps://kotlin.liying-cn.net/

\n

Kotlin Multiplatform \u7684\u6587\u6863\u6dfb\u52a0\u4e86\u4e0d\u5c11\uff0c\u8fd9\u6b21\u6765\u4e0d\u53ca\u7ffb\u8bd1\u4e86\uff0c\u7b49\u4e0b\u6b21\u5427

\n" }, { "author": { "url": "member/LiYing2016", "name": "LiYing2016", "avatar": "https://cdn.v2ex.com/avatar/53b7/8265/171460_large.png?m=1462193666" }, "url": "t/1140761", "title": "Kotlin \u4e2d\u6587\u6587\u6863 2.1.20 \u7248\u7ffb\u8bd1\u5b8c\u6210\u4e86", "id": "t/1140761", "date_published": "2025-06-24T12:51:54+00:00", "content_html": "

https://kotlin.liying-cn.net/

\n

\u524d\u4e00\u6b21\u6ca1\u6709\u7ffb\u8bd1\u7684\u8fd9\u4e00\u7ae0 \u201c\u6559\u7a0b - \u534f\u7a0b(Coroutine)\u4e0e\u901a\u9053(Channel)\u201d \u4e5f\u8865\u4e0a\u4e86\nhttps://kotlin.liying-cn.net/coroutines-and-channels.html

\n

\u6b22\u8fce\u5927\u5bb6\u591a\u591a\u8f6c\u53d1\uff0c\u5e2e\u5fd9\u5ba3\u4f20\u4e00\u4e0b\uff0c\u8c22\u8c22

\n" }, { "author": { "url": "member/LiYing2016", "name": "LiYing2016", "avatar": "https://cdn.v2ex.com/avatar/53b7/8265/171460_large.png?m=1462193666" }, "url": "t/1109315", "title": "Kotlin \u4e2d\u6587\u6587\u6863 2.1.0 \u7248\u7ffb\u8bd1\u5b8c\u6210\u4e86", "id": "t/1109315", "date_published": "2025-02-06T05:38:28+00:00", "content_html": "

Kotlin \u4e2d\u6587\u6587\u6863 2.1.0 \u7248\u7ffb\u8bd1\u5b8c\u6210\u4e86

\n

https://kotlin.liying-cn.net/whatsnew21.html

\n

\u6b22\u8fce\u5927\u5bb6\u591a\u591a\u8f6c\u53d1\uff0c\u5e2e\u5fd9\u5ba3\u4f20\u4e00\u4e0b\uff0c\u8c22\u8c22

\n" }, { "author": { "url": "member/LiYing2016", "name": "LiYing2016", "avatar": "https://cdn.v2ex.com/avatar/53b7/8265/171460_large.png?m=1462193666" }, "url": "t/1101413", "date_modified": "2024-12-30T15:24:55+00:00", "content_html": "

Kotlin \u4e2d\u6587\u6587\u6863 2.0.20 \u7248\u7ec8\u4e8e\u8d76\u5728\u5e74\u5185\u57fa\u672c\u4e0a\u7ffb\u8bd1\u5b8c\u6210\u4e86

\n

https://kotlin.liying-cn.net/whatsnew2020.html

\n

\u6b22\u8fce\u5927\u5bb6\u591a\u591a\u8f6c\u53d1\uff0c\u5e2e\u5fd9\u5ba3\u4f20\u4e00\u4e0b\uff0c\u8c22\u8c22

\n

\u8fd8\u6709\u51e0\u4e2a\u4e0d\u91cd\u8981\u7684\u9875\u9762\u6ca1\u6709\u7ffb\u8bd1\uff0c\u7559\u5230\u4e0b\u4e00\u6b21\u5427

\n

\u5b98\u65b9\u6587\u6863\u53c8\u66f4\u65b0\u5230\u4e86 2.1.0 \uff0c\u4e0b\u9762\u6765\u7ffb\u8bd1\u8fd9\u4e2a\u7248\u672c\uff0c\u4e89\u53d6 1 \u6708\u4ee5\u5185\u5b8c\u6210\u5427

\n", "date_published": "2024-12-30T15:24:37+00:00", "title": "Kotlin \u4e2d\u6587\u6587\u6863 2.0.20 \u7248\u7ffb\u8bd1\u5b8c\u6210\u4e86", "id": "t/1101413" }, { "author": { "url": "member/Fffys", "name": "Fffys", "avatar": "https://cdn.v2ex.com/gravatar/85fa8350ce7b30870cabe6b424636707?s=73&d=retro" }, "url": "t/1092936", "title": "MIUI API28+ActivityTransition API+kotlin \u65e0\u6cd5\u68c0\u6d4b\u5230\u6d3b\u52a8\uff0c\u53ea\u80fd\u624b\u52a8\u89e6\u53d1\u5e7f\u64ad\uff0c\u600e\u4e48\u5b9a\u4f4d\u95ee\u9898\uff1f", "id": "t/1092936", "date_published": "2024-11-26T21:51:45+00:00", "content_html": "

\u4e24\u4e2a\u6587\u4ef6\uff0cMainActivity.kt, ActivityTransitionReceiver.kt

\n

\u5177\u4f53\u5185\u5bb9\u89c1\u6211\u7684 Notion \u9875\u9762

\n

\u56e0\u4e3a\u53d1\u73b0\u53ea\u8981\u6709\u5176\u5b83\u5185\u5bb9\u5c31\u663e\u793a\uff0cSorry,you have been blocked you are unable to access v2ex.com

\n\n

\u63a5\u4e0b\u6765\u8981\u600e\u4e48\u5b9a\u4f4d\u95ee\u9898\u5462\uff1f

\n" }, { "author": { "url": "member/LiYing2016", "name": "LiYing2016", "avatar": "https://cdn.v2ex.com/avatar/53b7/8265/171460_large.png?m=1462193666" }, "url": "t/1087574", "title": "\u6211\u8001\u4eba\u5bb6\u7ffb\u8bd1\u7684 Kotlin \u4e2d\u6587\u6587\u6863\uff0c\u6b63\u5728\u66f4\u65b0\u5230\u6700\u65b0\u7684 2.0.20 \u7248", "id": "t/1087574", "date_published": "2024-11-07T14:51:47+00:00", "content_html": "

\u6211\u8001\u4eba\u5bb6\u7ffb\u8bd1\u7684 Kotlin \u4e2d\u6587\u6587\u6863\uff0c\u6b63\u5728\u66f4\u65b0\u5230\u6700\u65b0\u7684 2.0.20 \u7248

\n

\u4e00\u5171 330 \u4e2a\u5de6\u53f3\u7684\u9875\u9762\uff0c\n\u53d8\u66f4\u8f83\u5c11\u7684\u9875\u9762\u5df2\u7ecf\u66f4\u65b0\u5b8c\u6210\u4e86\n\u8fd8\u5269\u4e0b\u53d8\u66f4\u6bd4\u8f83\u591a\u7684 60 \u4e2a\u5de6\u53f3\u9875\u9762\uff0c\u5927\u7ea6 300 \u9875\u5185\u5bb9\n\u4e89\u53d6 12 \u6708\u6216 1 \u6708\u4ee5\u5185\u80fd\u591f\u5b8c\u6210

\n

https://kotlin.liying-cn.net/home.html

\n" }, { "author": { "url": "member/LiYing2016", "name": "LiYing2016", "avatar": "https://cdn.v2ex.com/avatar/53b7/8265/171460_large.png?m=1462193666" }, "url": "t/1081150", "title": "\u6211\u8001\u4eba\u5bb6\u7ffb\u8bd1\u7684\u300aKotlin \u8bed\u8a00\u53c2\u8003\u6587\u6863\u300b\u4e2d\u6587\u7248\uff0c\u5df2\u7ecf\u8fc1\u79fb\u5230\u4e86\u65b0\u7684 Writerside \u73af\u5883", "id": "t/1081150", "date_published": "2024-10-17T04:26:02+00:00", "content_html": "

\u6211\u8001\u4eba\u5bb6\u7ffb\u8bd1\u7684\u300a Kotlin \u8bed\u8a00\u53c2\u8003\u6587\u6863\u300b\u4e2d\u6587\u7248\uff0c\u5df2\u7ecf\u8fc1\u79fb\u5230\u4e86\u65b0\u7684 Writerside \u73af\u5883

\n

\u73b0\u5728\u751f\u6210\u7684\u9875\u9762\u98ce\u683c\u548c\u5b98\u65b9\u6587\u6863\u57fa\u672c\u4e00\u6837\u4e86\uff0c\u6e05\u723d\u4e86\u5f88\u591a

\n

\u6b22\u8fce\u8bbf\u95ee\nhttps://kotlin.liying-cn.net/about-translation.html

\n" }, { "author": { "url": "member/jeesk", "name": "jeesk", "avatar": "https://cdn.v2ex.com/gravatar/ad011d1d1e836aac8ae7bdc3a5b35c2f?s=73&d=retro" }, "url": "t/1079399", "date_modified": "2024-10-11T17:36:55+00:00", "content_html": "
    \n
  1. \u6bd4\u5982\u6211\u8981\u7edf\u4e00\u5904\u7406\u767b\u9646\u5931\u8d25\u548c\u7f51\u7edc\u9519\u8bef\u3002
  2. \n
\n

\u5982\u679c\u662f\u5728 java \u91cc\u9762\u76f4\u63a5\u5728\u65b9\u6cd5\u91cc\u9762\u629b\u51fa 2 \u4e2a\u5f02\u5e38\u5373\u53ef\u3002 \u4f46\u662f\u5728 kotlin \u91cc\u9762\u5fc5\u987b

\n
\tval runResult = runCatching{\n HttpResponse(it.isSuccessful,it.code,it.message)\n }\n if(runResult.isFailure){\n when(moveFileAgain.exceptionOrNull()){\n // \u5355\u72ec\u5904\u7406\u5f02\u5e38\n \n }\n \n }\n // \u8fd8\u6709\u5199\u4e00\u4e9b(\u8fd9\u91cc\u8bf7\u6c42\u6210\u529f\u4e86)\n if(result.code == 404){\n return runResult.getOrDefault()\n }\n if(result.code == 401){\n // \u8ba4\u8bc1\u5931\u8d25\u4e86\n return runResult.getOrDefault()\n }\n \n\n
\n

\u5982\u679c\u662f\u5728 java \u91cc\u9762\u5c31\u518d\u7b80\u5355\u4e0d\u8fc7\u4e86\uff0c\u76f4\u63a5\u5b9a\u4e49\u4e24\u4e2a\u5f02\u5e38\uff0c\u5168\u5c40\u5904\u7406. \u53d7\u68c0\u67e5\u5f02\u5e38\u662f\u771f\u7684\u723d\u3002 \u7279\u522b\u662f\u5728\u5d4c\u5957\u8bf7\u6c42\uff0c1 \u4e2a api \u8981\u8bf7\u6c42\u597d\u51e0\u6b21\u7684\u60c5\u51b5\u3002

\n

\u8fd9\u4e48\u8bf4\u5427\u3002 \u8fd9\u91cc\u9762\u7684\u5f88\u591a\u5e38\u89c1\u4f7f\u7528 java \u6765\u5199\u4ee3\u7801\u53ef\u80fd\u8981\u7b80\u5355\u7684\u591a\u3002 \u54ea\u6709\u8fd9\u4e48\u591a\u7684\u7834\u4e8b\u3002

\n

\u5927\u4f6c\u4eec\u6709\u4ec0\u4e48\u529e\u6cd5\u5904\u7406\u8fd9\u79cd\u4e8b\u60c5\uff0c \u6211\u7684\u8981\u6c42\u5c31\u662f\u767b\u9646 401 \u6216\u8005\u6709\u5f02\u5e38\u76f4\u63a5\u8fd4\u56de\u5c31\u662f\u4e86\u3002kotlin \u5b9e\u5728\u662f\u592a\u7e41\u7410\u4e86\u3002

\n", "date_published": "2024-10-11T17:28:19+00:00", "title": "kotlin \u6ca1\u6709\u53d7\u68c0\u5f02\u5e38\u771f\u592a\u96be\u9876\u4e86\u3002\u5410\u69fd", "id": "t/1079399" }, { "author": { "url": "member/300", "name": "300", "avatar": "https://cdn.v2ex.com/avatar/55fe/29e6/116124_large.png?m=1720510511" }, "url": "t/1077764", "date_modified": "2024-10-07T03:07:14+00:00", "content_html": "

\u5927\u5bb6\u90fd\u77e5\u9053 Kotlin \u6709\u7a7a\u5b89\u5168

\n

var s: String \u4ee3\u8868\u4e0d\u4e3a\u7a7a

\n

var s: String? \u4ee3\u8868\u53ef\u4e3a\u7a7a

\n

\u5947\u8469\u64cd\u4f5c\u6765\u4e86\uff0c\u5728\u6211\u63a5\u624b\u4e4b\u524d\uff0c\u9664\u4e86\u7edd\u5927\u90e8\u5206\u7684\u57fa\u672c\u53d8\u91cf\uff0c\u5176\u4f59\u6240\u6709\u53d8\u91cf\u90fd\u662f String?\u3001Objxx?

\n

\u4f7f\u7528\u7684\u65f6\u5019\uff1a

\n
if (S != null) print(s) else throw Exption(\"s shouldn't be null\")\n
\n

\u6216\u8005\uff1a

\n
if (obj?.s == null) return\nobj!!.s\n
\n

\u4e00\u5f00\u59cb\u5f88\u597d\u5947\u8fd9\u4e2a\u8111\u6b8b\u5199\u6cd5\u662f\u600e\u4e48\u6765\u7684

\n

\u7136\u540e\u9047\u5230\u4e86\u4e00\u4e2a crash \u6211\u627e\u5230\u6839\u6e90\u4e86\u3002\u6211\u5199\u7684\u4ee3\u7801\u91cc\u6ca1\u6709\u7528 String? \uff0c\u4f46\u662f\u5374\u62a5\u4e86 NPE \uff0c\u8d4b\u503c\u7684\u5730\u65b9\u90fd\u67e5\u8fc7\u4e86\uff0c\u4e0d\u5b58\u5728 null \u3002\u6700\u7ec8\u4e0d\u65ad\u5730\u8c03\u8bd5\u53d1\u73b0\u6bcf\u6b21\u9875\u9762 onDestory()\u7684\u65f6\u5019\u4f1a\u6709\u4e2a\u53cd\u5c04\u9012\u5f52\u5730\u5c06\u6240\u6709\u53d8\u91cf\u548c\u53d8\u91cf\u91cc\u7684\u53d8\u91cf\u90fd\u8bbe\u7f6e\u6210 null \uff08\u8bf4\u662f\u5728\u624b\u52a8 GC\u2026\uff09\u3002\u53c8\u56e0\u4e3a\u9b54\u6539\u4e86\u751f\u547d\u5468\u671f+\u534f\u7a0b\uff0c\u8bfb\u53d6\u53d8\u91cf\u7684\u65f6\u5019\u5df2\u7ecf\u662f null \u4e86\uff0c\u7136\u540e\u62a5\u9519==

\n

\uff01

\n", "date_published": "2024-10-05T07:03:32+00:00", "title": "\u5c4e\u5c71\u4ee3\u7801\u4e00\u5219", "id": "t/1077764" }, { "author": { "url": "member/fuhanfeng", "name": "fuhanfeng", "avatar": "https://cdn.v2ex.com/avatar/9e6b/c039/14220_large.png?m=1736744506" }, "url": "t/1042866", "title": "Kotlin 2.0.0 \u6b63\u5f0f\u7248\u53d1\u5e03\u4e86", "id": "t/1042866", "date_published": "2024-05-22T02:55:25+00:00", "content_html": "

\"\"

\n

https://kotlinlang.org/docs/whatsnew20.html

\n

GPT-4o \u7684\u603b\u7ed3\uff1a

\n

Kotlin 2.0 \u4eae\u70b9

\n
    \n
  1. \n

    K2 \u7f16\u8bd1\u5668\uff1a

    \n\n
  2. \n
  3. \n

    IDE \u652f\u6301\uff1a

    \n\n
  4. \n
  5. \n

    Gradle \u96c6\u6210\uff1a

    \n\n
  6. \n
  7. \n

    Lambda \u51fd\u6570\uff1a

    \n\n
  8. \n
  9. \n

    Kotlinx-metadata-jvm \u5e93\uff1a

    \n\n
  10. \n
  11. \n

    Kotlin/Native \u589e\u5f3a\uff1a

    \n\n
  12. \n
  13. \n

    Kotlin/Wasm\uff1a

    \n\n
  14. \n
  15. \n

    \u667a\u80fd\u7c7b\u578b\u8f6c\u6362\uff1a

    \n\n
  16. \n
\n
\n

Kotlin 2.0.0 \u8bed\u8a00\u5c42\u9762\u6ca1\u6709\u65b0\u7279\u6027\uff0c\u4f46\u662f\u5f15\u5165 K2 \u7f16\u8bd1\u5668\uff0c\u63d0\u9ad8\u4e86\u6027\u80fd\u3002

\n

\u60f3\u95ee\u4e00\u4e0b\u5927\u5bb6\u4e0a\u6d77/\u676d\u5dde\u6709\u7528 Kotlin \u505a\u670d\u52a1\u7aef\u7684\u516c\u53f8\u5417\uff1f

\n" }, { "author": { "url": "member/zhwguest", "name": "zhwguest", "avatar": "https://cdn.v2ex.com/avatar/b633/f688/433522_large.png?m=1685067457" }, "url": "t/1013521", "title": "kotlin \u4e2d\u7684 select \u5230\u5e95\u53ef\u4ee5 select \u54ea\u4e9b\u5185\u5bb9\u554a\uff1f", "id": "t/1013521", "date_published": "2024-02-01T13:58:02+00:00", "content_html": "

\u597d\u591a\u51fd\u6570\u88ab deprecated \u4e86\uff0c\u6709\u6ca1\u6709\u4e00\u4e2a\u8ddf\u7248\u672c\u76f8\u5173\u7684\u5b98\u65b9\u63cf\u8ff0\uff1f

\n" }, { "author": { "url": "member/zhwguest", "name": "zhwguest", "avatar": "https://cdn.v2ex.com/avatar/b633/f688/433522_large.png?m=1685067457" }, "url": "t/1012103", "title": "\u8bf7\u5927\u4f6c\u5e2e\u5fd9\u770b\u4e00\u773c\u6211\u8fd9\u4e2a\u6ce8\u89e3\u4e3a\u4ec0\u4e48\u6ca1\u80fd\u6291\u5236 never used \u8b66\u544a\uff1f", "id": "t/1012103", "date_published": "2024-01-27T13:25:05+00:00", "content_html": "
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)\n@Retention(AnnotationRetention.SOURCE)\n@Suppress(\"unused\", \"CanBePrivate\")\nannotation class Api\n
\n

\"\u8fd8\u662f\u88ab\u8b66\u544a\u4e86\"

\n" }, { "author": { "url": "member/LiYing2016", "name": "LiYing2016", "avatar": "https://cdn.v2ex.com/avatar/53b7/8265/171460_large.png?m=1462193666" }, "url": "t/1004557", "title": "\u6211\u8001\u4eba\u5bb6\u7ffb\u8bd1\u7684\u300aKotlin \u8bed\u8a00\u53c2\u8003\u6587\u6863\u300b\u4e2d\u6587\u7248", "id": "t/1004557", "date_published": "2023-12-29T18:59:49+00:00", "content_html": "

\u6700\u65e9\u7684\u7248\u672c\u662f 2016 \u5e74 04 \u6708\uff0c\u4e00\u76f4\u5728\u66f4\u65b0\uff0c\u5230 2023 \u5e74 04 \u6708\u66f4\u65b0\u5230\u4e86 Kotlin 1.8.0

\n

\u73b0\u5728\u6700\u65b0\u7684 1.9.20 \u6b63\u5728\u7ffb\u8bd1\uff0c\u4e89\u53d6 1 \u5230 2 \u4e2a\u6708\u5185\u5b8c\u6210

\n

\u5730\u5740\nhttps://kotlin.liying-cn.net/docs/reference_zh/about_translation.html

\n

\u4ee3\u7801\u5e93\nhttps://github.com/LiYing2010/kotlin-web-site

\n

\u6b22\u8fce\u8bbf\u95ee

\n" }, { "author": { "url": "member/coderpwh", "name": "coderpwh", "avatar": "https://cdn.v2ex.com/avatar/9527/a2d1/585855_large.png?m=1770607152" }, "url": "t/996109", "date_modified": "2023-11-29T01:06:06+00:00", "content_html": "

\u4f7f\u7528 compose \u5f00\u53d1\u4e86\u8baf\u98de\u661f\u706b\u8ba4\u77e5\u6a21\u578b\u684c\u9762\u7aef\u5e94\u7528\uff0c\u76ee\u524d\u652f\u6301 windows,mac \u7cfb\u7edf\n\u6b22\u8fce\u5404\u4f4d\u4f7f\u7528\uff0c\u5f00\u6e90\u5730\u5740\uff1a https://github.com/pwh-pwh/sparkapidesk\n\u76ee\u524d\u529f\u80fd\uff08\u7b80\u6d01\uff09\uff0c\u6b22\u8fce\u53cd\u9988\u6216\u8005 pr,\u4e5f\u53ef\u4f5c\u4e3a\u5b66\u4e60\u9879\u76ee\n\u754c\u9762\u622a\u56fe\n\"https://github.com/pwh-pwh/sparkapidesk/raw/master/img%2Fmain.png\"

\n", "date_published": "2023-11-29T01:05:06+00:00", "title": "\u4f7f\u7528 compose \u5f00\u53d1\u4e86\u8baf\u98de\u661f\u706b\u8ba4\u77e5\u6a21\u578b\u684c\u9762\u7aef\u5e94\u7528", "id": "t/996109" }, { "author": { "url": "member/githmb", "name": "githmb", "avatar": "https://cdn.v2ex.com/gravatar/eedfc3342f1825cee8be1d8a4578a5aa?s=73&d=retro" }, "url": "t/973321", "date_modified": "2023-09-13T23:31:20+00:00", "content_html": "

\u6211\u8fd8\u4ee5\u4e3a\u4f1a\u50cf Rust \u4e00\u6837\u628a IO \u51fd\u6570\u90fd\u7528\u5f02\u6b65\u5b9e\u73b0\u4e00\u904d\uff0c\u7ed3\u679c\u53ea\u662f\u628a Job \u653e\u5230 Dispatchers.IO \u7ebf\u7a0b\u6c60\u91cc\u8c03\u5ea6\uff0c\u90a3\u5c82\u4e0d\u662f\u8be5\u5835\u585e\u7684\u8fd8\u662f\u4f1a\u5835\u585e\uff0c\u5982\u679c\u7ebf\u7a0b\u6c60\u91cc\u7684\u6240\u6709\u7ebf\u7a0b\u90fd\u88ab\u5835\u585e\u4e86\uff0c\u5269\u4e0b\u7684 Job \u4e0d\u5c31\u6ca1\u6cd5\u6267\u884c\u4e86\uff0c\u53c8\u4e0d\u662f Go \u8bed\u8a00\u90a3\u6837\u7684\u6709\u6808\u534f\u7a0b\u53ef\u4ee5\u968f\u65f6\u4e2d\u65ad\uff0c\u65e0\u6808\u534f\u7a0b\u5c31\u5e94\u8be5\u7528 NIO \u5b9e\u73b0\u9ad8 IO \u541e\u5410\u91cf\u554a

\n

\u96be\u9053\u8bf4 Kotlin \u7684\u534f\u7a0b\u76ee\u524d\u7684\u552f\u4e00\u4f5c\u7528\u5c31\u662f\u8ba9\u5b89\u5353\u540c\u5b66\u4e0d\u4f1a\u628a UI \u5361\u6b7b\u5417\uff1f

\n", "date_published": "2023-09-13T03:30:48+00:00", "title": "Kotlin \u7684\u534f\u7a0b\u5230\u5e95\u662f\u7528\u6765\u5e72\u561b\u7684\uff1f\u4e3a\u4ec0\u4e48\u6ca1\u6709\u53ef suspend \u7684\u5f02\u6b65 IO \u51fd\u6570\uff1f", "id": "t/973321" }, { "author": { "url": "member/Akitora", "name": "Akitora", "avatar": "https://cdn.v2ex.com/avatar/7ac0/8306/567083_large.png?m=1775664267" }, "url": "t/972871", "title": "Kotlin \u534f\u7a0b Coroutine \u4e0e Spring Boot \u9879\u76ee\u6574\u5408\u7684\u6700\u4f73\u5b9e\u8df5\u662f\u600e\u6837\u7684\uff1f", "id": "t/972871", "date_published": "2023-09-11T15:07:09+00:00", "content_html": "

RT \uff0c\u524d\u51e0\u5929\u65e0\u610f\u95f4\u53d1\u73b0 Spring MVC + JDBC \u7ecf\u5178\u7ec4\u5408\u4e2d\u7684\u4e8b\u52a1\u4e0e Kotlin \u534f\u7a0b\u4f3c\u4e4e\u5b58\u5728\u4e00\u5b9a\u7684\u517c\u5bb9\u95ee\u9898

\n

\u4f9d\u636e Spring \u5b98\u65b9\u6587\u6863 \u7684\u8bf4\u660e\u662f\uff0cSpring \u76ee\u524d\u4ec5\u652f\u6301 R2DBC \u4e8b\u52a1\u4e0e Kotlin \u534f\u7a0b\u7684\u7ec4\u5408\uff0cJDBC \u4e8b\u52a1\u9700\u8981\u7528\u5230 ThreadLocal \uff0c\u5728\u534f\u7a0b\u4e2d\u542f\u52a8\u4e8b\u52a1\u4f1a\u51fa\u95ee\u9898\uff0c\u76f8\u5173\u8ba8\u8bba\u548c\u95ee\u9898\u53ef\u4ee5\u53c2\u8003\u4ee5\u4e0b\u94fe\u63a5\uff1a

\n

Spring Framework GitHub Issue

\n

Stack Overflow \u95ee\u9898

\n

\u6211\u76ee\u524d\u5bf9\u54cd\u5e94\u5f0f\u6846\u67b6\u7684\u4e86\u89e3\u8fd8\u4e0d\u8db3\uff0c\u6240\u4ee5\u6211\u60f3\u8bf7\u6559\u4e00\u4e0b\uff0c\u662f\u4e0d\u662f\u4e3a\u4e86\u5145\u5206\u53d1\u6325 Kotlin \u534f\u7a0b\u7684\u4f18\u52bf\uff0c\u5c31\u5fc5\u987b\u5c06\u9879\u76ee\u6574\u4f53\u8fc1\u79fb\u5230 WebFlux + R2DBC \u4e0b\uff1f

\n

\u53e6\u5916\uff0c\u6211\u4e5f\u60f3\u4e86\u89e3\u4e00\u4e0b\uff0c\u5373\u5c06\u5230\u6765\u7684 JDK 21 \u7684\u865a\u62df\u7ebf\u7a0b\u548c Kotlin \u534f\u7a0b\u4f1a\u6709\u600e\u6837\u7684\u5173\u7cfb\uff1f

\n

\u611f\u8c22\u5404\u4f4d\u7684\u5e2e\u52a9\u4e0e\u610f\u89c1\u3002

\n" }, { "author": { "url": "member/VforVendetta", "name": "VforVendetta", "avatar": "https://cdn.v2ex.com/avatar/5e1d/d362/451056_large.png?m=1718169471" }, "url": "t/959210", "title": "\u8c37\u6b4c\u51fa\u54c1 kotlin \u5165\u95e8\u6559\u7a0b", "id": "t/959210", "date_published": "2023-07-24T05:54:42+00:00", "content_html": "

https://developer.android.com/courses/pathways/android-basics-compose-unit-1-pathway-1?hl=zh-cn#codelab-https://developer.android.com/codelabs/basic-android-kotlin-compose-variables

\n" }, { "author": { "url": "member/bigtang", "name": "bigtang", "avatar": "https://cdn.v2ex.com/gravatar/7c35e0d473d8f7d42342c9163fbdb93c?s=73&d=retro" }, "url": "t/950972", "date_modified": "2023-06-23T00:45:16+00:00", "content_html": "\u5f88\u591a\u516c\u53f8\u4e0d\u613f\u610f\u4ece java \u8f6c\u5411 kotlin \uff0c\u539f\u56e0\u662f\u4f60\u80fd\u60f3\u5230\u7684\u51e0\u4e4e\u6240\u6709\u7f16\u7a0b\u95ee\u9898\uff0cbug \uff0c\u4e00\u641c\u7d22\u90fd\u4f1a\u6709\u4e00\u5806 java \u6848\u4f8b\uff0c\u800c kotlin \uff0c\u90a3\u5219\u5c11\u7684\u53ef\u601c\uff0c\u56e0\u4e3a kotlin \u6bd5\u7adf\u662f\u4e00\u95e8\u65b0\u751f\u8bed\u8a00\uff0c\u867d\u7136 java \u53ef\u4ee5\u8f6c\u4e3a kotlin \uff0c\u4f46\u5bf9 kotlin \u65b0\u624b\u8fd8\u662f\u4e0d\u53cb\u597d\uff0c\u8f6c\u6362\u7ecf\u5e38\u4f1a\u4ea7\u751f\u4e00\u4e9b\u7f16\u8bd1\u9519\u8bef\uff0c\u65b0\u624b\u4e00\u7b79\u83ab\u5c55\u3002

\u5982\u679c\u6709\u5927\u91cf\u7684 kotlin \u6e90\u4ee3\u7801\u53ef\u53c2\u8003\uff0c\u8fd9\u4e2a\u95ee\u9898\u4f1a\u5927\u6709\u6539\u89c2\u3002

BigCode \u6570\u636e\u96c6\u662f\u4e00\u4e2a\u5f00\u653e\u7684\u79d1\u5b66\u5408\u4f5c\u9879\u76ee\uff0c\u65e8\u5728\u8d1f\u8d23\u4efb\u5730\u8bad\u7ec3\u5927\u8bed\u8a00\u6a21\u578b\uff0c\u4ee5\u5e94\u7528\u4e8e\u7f16\u7801\u9886\u57df\u3002\u8be5\u6570\u636e\u96c6\u5305\u542b\u4e86\u6765\u81ea Stack Exchange \u5e73\u53f0\u4e0a\u7684\u95ee\u9898\u548c\u7b54\u6848\uff0c\u5305\u62ec StackOverflow \u7684\u7f16\u7a0b\u8bdd\u9898\u4e0b\u7684\u95ee\u9898\u548c\u7b54\u6848\u3002BigCode \u6570\u636e\u96c6\u53ef\u4ee5\u7528\u4e8e\u8bb8\u591a\u81ea\u7136\u8bed\u8a00\u5904\u7406\u4efb\u52a1\uff0c\u5982\u4ee3\u7801\u8865\u5168\u3001\u4ee3\u7801\u6458\u8981\u3001\u4ee3\u7801\u641c\u7d22\u7b49\u3002\u6b64\u5916\uff0cBigCode \u6570\u636e\u96c6\u8fd8\u53ef\u4ee5\u7528\u4e8e\u7814\u7a76\u4ee3\u7801\u7684\u8bed\u4e49\u548c\u7ed3\u6784\uff0c\u4ee5\u53ca\u4ee3\u7801\u7684\u6f14\u5316\u548c\u53d8\u5316\u3002BigCode \u9879\u76ee\u4e2d\u5305\u542b\u4e86 StarCoder \u3001The Stack \u548c SantaCoder \u7b49\u5de5\u4ef6\uff0c\u5176\u4e2d StarCoder \u662f\u7528\u4e8e\u7f16\u7801\u7684\u6700\u5148\u8fdb\u7684\u8bed\u8a00\u6a21\u578b\uff0cThe Stack \u662f\u53ef\u7528\u7684\u6700\u5927\u7684\u9884\u8bad\u7ec3\u6570\u636e\u96c6\uff0c\u5305\u542b\u5bbd\u5bb9\u7684\u4ee3\u7801\uff0c\u800c SantaCoder \u662f\u4e00\u4e2a\u53c2\u6570\u8fbe\u5230 1.1B \u7684\u7f16\u7801\u6a21\u578b\u3002

BigCode \u4e2d\u5c31\u6709\u5927\u91cf\u7684 kotlin \u6e90\u7801\uff0c\u6570\u91cf\u662f 13G, 375 \u4e07\u4e2a kt \u6587\u4ef6.
\u4e0b\u8f7d\u65b9\u6cd5\uff1a https://huggingface.co/datasets/bigcode/the-stack/tree/main/data
\u6253\u5f00\u540e\uff0c\u70b9\u51fb\u5e95\u90e8\u7684 Load more files, \u76f4\u5230\u770b\u89c1 kotlin, \u70b9\u51fb kotlin
\u5c31\u4f1a\u770b\u5230\u6709 15 \u4e2a parquet \u6587\u4ef6\u4e0b\u8f7d
\u53ef\u4ee5\u7528 Python \u5bf9 parquet \u6587\u4ef6\u89e3\u538b\uff1a

import pyarrow.parquet as pq
table = pq.read_table('input.parquet')
table.to_pandas().to_csv('output.csv')

\u8fd9\u6837\u4f60\u5c31\u53ef\u4ee5\u5728\u672c\u5730\u68c0\u7d22 kotlin \u6e90\u4ee3\u7801\u4e86\uff0c
\u5728\u7ebf\u641c\u7d22\uff1a\u6e90\u4ee3\u7801\u641c\u7d22\u7f51\u7ad9 www.tanglib.com \u63d0\u4f9b\u4e86\u672c kotlin \u6e90\u4ee3\u7801\u6570\u636e\u96c6\u5728\u7ebf\u5168\u6587\u68c0\u7d22\u3002", "date_published": "2023-06-23T00:44:44+00:00", "title": "kotlin \u6e90\u4ee3\u7801\u6570\u636e\u96c6", "id": "t/950972" }, { "author": { "url": "member/Byl2024", "name": "Byl2024", "avatar": "https://cdn.v2ex.com/gravatar/525d9949c5babcf5b3541017eb5c8538?s=73&d=retro" }, "url": "t/947375", "title": "KMM \u4e2d\u76ee\u524d\u6700\u6210\u719f\uff0c\u6700\u63a8\u8350\u7684 shared viewmodel \u65b9\u6848\u662f\u4ec0\u4e48.", "id": "t/947375", "date_published": "2023-06-09T09:17:37+00:00", "content_html": "

\u636e\u6211\u6240\u67e5\uff0cUI \u5c42, \u6b63\u5728\u9010\u6b65\u7edf\u4e00, \u6bd4\u5982\u8fd1\u671f\u63a8\u51fa\u7684 Compose Multiplatform, VM \u5c42\u8c8c\u4f3c\u5b98\u65b9\u6ca1\u6709\u63a8\u51fa\u81ea\u5df1\u7684\u89e3\u51b3\u65b9\u6848.

\n

\u6bd4\u5982\u5728 Compose Multiplatform \u4e2d\u63d0\u4f9b\u7684\u7684\u4f8b\u5b50\u90fd\u662f\u5f15\u7528\u4e09\u65b9\u7684\uff0c\u5982 MVIKotlin(\n\u89c1 https://github.com/JetBrains/compose-multiplatform/blob/master/examples/todoapp/common/main/build.gradle.kts)

\n

\u6240\u4ee5 VM \u5c42\u73b0\u5728\u6700\u63a8\u8350\u7684\u89e3\u51b3\u65b9\u6848\u662f\u4ec0\u4e48\u6837\u7684\uff1f

\n" }, { "author": { "url": "member/r1nice", "name": "r1nice", "avatar": "https://cdn.v2ex.com/gravatar/aa6229f9afc2d83475e724f9d45ff654?s=73&d=retro" }, "url": "t/924685", "title": "\u200b Java /kotlin AST \u6784\u5efa\u76f8\u5173\uff0c\u60ac\u8d4f 200 \u6c42\u89e3\uff0c\u4eba\u5df2\u7ecf\u9ebb\u4e86", "id": "t/924685", "date_published": "2023-03-16T15:17:09+00:00", "content_html": "

\u5199\u5728\u524d\u9762\uff1a\n\u7ed9\u51fa\u7684\u60ac\u8d4f\u53ef\u80fd\u5728\u5404\u4f4d\u773c\u91cc\u770b\u8d77\u6765\u6bd4\u8f83\u53ef\u7b11\uff0c\u4f46\u5bf9\u6211\u6765\u8bf4\u8fd9\u662f\u6211\u4e24\u5929\u7684\u751f\u6d3b\u8d39\u4e86\uff0c\u7f51\u4e0a\u7684\u6559\u7a0b\u4e71\u4e03\u516b\u7cdf\uff0c\u76ee\u524d\u7684\u8fd9\u4e2a\u67b6\u6784\u662f\u5728 chatGPT \u8bbe\u8ba1\u7684\u7ed3\u6784\u4e0a\u9b54\u6539\u7684\uff0c\u4f46\u51fa\u4e86\u4e25\u91cd\u7684\u95ee\u9898\u3002\u5982\u679c\u80fd\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u5b81\u613f\u4e0d\u5403\u4e0d\u559d\u4e24\u5929\u6574\n\u63d0\u524d\u8c22\u8c22\u5404\u4f4d\u4e86\uff0c\u8fd9\u9879\u76ee\u662f\u81ea\u5df1\u73a9\u6574\u7684\uff0c\u522b\u7684\u90fd\u597d\u4e86\uff0c\u5c31\u5361\u5728\u4e00\u4e2a ast \u4e0a\uff0c\u867d\u7136\u662f\u81ea\u5df1\u505a\u7740\u73a9\u7684\uff0c\u4f46\u5b9e\u5728\u4e0d\u60f3\u524d\u529f\u5c3d\u5f03

\n

\u8fd9\u8fb9\u7684\u6e38\u620f\u9700\u8981\u8bbe\u8ba1\u4e00\u4e2a\u53ef\u4ee5\u5c06\u6548\u679c\u539f\u5b50\u5316\u548c\u5e8f\u5217\u5316\u7684\u529f\u80fd\uff0c\u7531\u4e8e function \u65b9\u6cd5\u4e0d\u53ef\u88ab\u539f\u5b50\u5316\uff0c\u4e14\u6211\u8fd9\u8fb9\u65e0\u6cd5\u4f7f\u7528 lua \uff0c\u56e0\u6b64\u6211\u8bbe\u8ba1\u4e86\u4e00\u4e2a\u80fd\u8f93\u5165\u548c\u8f93\u51fa\u4efb\u610f\u7c7b\u578b\u7684\u62bd\u8c61\u8bed\u6cd5\u6811\uff0c\u53ef\u4ee5\u5bf9\u5176\u8282\u70b9\u8fdb\u884c\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316\uff0c\u4ece\u800c\u4f7f\u5f97\u6574\u4e2a\u6811\u53ef\u4ee5\u5e8f\u5217\u5316\u3002\u5f53\u524d\u8bbe\u8ba1\u5982\u4e0b\uff1a\n\u6709\u4e00\u4e2a\u63a5\u53e3(astNode)\uff0c\u7b80\u79f0\u57fa\u7c7b\uff0c\u6709\u4e00\u4e2a\u6cdb\u578b O \uff0c\u6709\u4e00\u4e2a operation \u65b9\u6cd5\uff0c\u8f93\u51fa\u7c7b\u578b\u662f O \uff0c\u4f20\u53c2\u662f map<string \uff0cobject>\n\u5728\u57fa\u7c7b\u7b2c\u4e8c\u5c42\u7684\u662f\u7ed3\u6784\u5316\u8282\u70b9\uff1a\u53f6\u5b50\u8282\u70b9\u548c\u679d\u5e72\u8282\u70b9\uff0c\u90fd\u7ee7\u627f\u81ea\u7b2c\u4e00\u5c42\u3002\n\u53f6\u5b50\u8282\u70b9\u53ea\u5b58\u50a8\u4e00\u4e2a\u503c\uff0c\u4f46\u4e0d\u80fd\u5b58\u8282\u70b9\uff0c\u6709\u4e24\u4e2a\u6cdb\u578b\uff0c\u4e00\u4e2a\u662f\u8bb0\u5f55\u5b58\u50a8\u5c5e\u6027\u7c7b\u578b\u7684\uff0c\u4e00\u4e2a\u662f\u8bb0\u5f55\u8fd4\u56de\u7c7b\u578b\u7684\u3002\u53f6\u5b50\u8282\u70b9\u5c31\u4e24\u79cd\uff0c\u4e00\u79cd\u8bb0\u5f55\u5e38\u6570(constant)\uff0c\u6bd4\u5982 2x+1 \u91cc\u7684 2 \u548c 1.\n\u53e6\u4e00\u79cd\u8bb0\u5f55\u672a\u77e5\u6570(param)\uff0c\u5c31\u662f 2x+1 \u91cc\u7684 x \uff0c\u4ed6\u4f1a\u8bfb\u53d6 operation \u65b9\u6cd5\u4f20\u8fc7\u6765\u7684 map \uff0c\u4ece\u91cc\u9762\u627e\u5230\u5bf9\u5e94\u7684\u5bf9\u8c61\u3002\n\u679d\u5e72\u8282\u70b9\u5219\u91cc\u9762\u53ef\u4ee5\u5b58\u50a8\u53f6\u5b50\u8282\u70b9\u6216\u679d\u5e72\u8282\u70b9\u3002\n\u4ed6\u4eec\u6709\u4e09\u79cd\u7c7b\u578b\uff0c\u5355\u8282\u70b9\u578b\uff0clist \u578b\u548c pair \u578b\uff0c\u5355\u8282\u70b9\u7684\uff0c\u6bd4\u5982\u63d0\u53d6\u76ee\u6807\u602a\u517d\u7684\u8840\u91cf\uff0c\u91cc\u9762\u5c31\u53ea\u9700\u8981\u8bb0\u5f55\u4e00\u4e2a\u6307\u5411\u602a\u517d\u7684\u53f6\u5b50\u8282\u70b9\u3002\u53cc\u8282\u70b9\u6700\u5e38\u89c1\uff0c\u52a0\u51cf\u4e58\u9664\uff0coperation \u65b9\u6cd5\u5c31\u662f\u5c06\u4e24\u4e2a\u8282\u70b9 operation \u7684\u503c\u8fdb\u884c\u8fd0\u7b97\u3002list \u8282\u70b9\u5219\u662f\u7c7b\u4f3c in \uff0c\u4f20\u5165\u4e00\u4e2a list \uff0c\u4ed6\u4ece\u91cc\u9762\u8fd4\u56de\u4e00\u4e2a\u7b26\u5408\u9700\u6c42\u7684\u503c\u3002\n\u7136\u540e\u7b2c\u4e09\u5c42\u5c31\u662f\u5bf9\u8fd0\u7b97\u76ee\u6807\u7684\u7c7b\u578b\u8fdb\u884c\u5b9a\u4e49\u7684\u5c42\u3002\u6bd4\u5982 equals \uff0c\u6709\u9488\u5bf9\u6570\u5b57\u7684 equals \uff0c\u6709\u9488\u5bf9\u602a\u7269\u5b9e\u4f53\u7684 equals \uff0c\u7b49\u7b49\uff0c\u8fd9\u4e00\u5c42\u5c06\u4ed6\u4eec\u8fdb\u884c\u5c01\u88c5\u3002\n\u7b2c\u56db\u5c42\u662f\u5c01\u88c5\u5c42\uff0c\u8fd9\u5c42\u4f1a\u5c06\u6240\u6709\u6cdb\u578b\u5168\u90e8\u5339\u914d\uff0c\u4e0d\u4f1a\u51fa\u73b0\u9700\u8981\u5728\u5916\u9762\u8f93\u5165\u6cdb\u578b\u7684\u60c5\u51b5\u3002\n\u5728\u6700\u5916\u4fa7\uff0c\u4f1a\u6709\u4e00\u4e2a tree \u5b9e\u4f53\uff0c\u8fd9\u4e2a\u5b9e\u4f53\u53ef\u4ee5\u8bbf\u95ee\u6839\u8282\u70b9\uff0c\u5e76\u8fdb\u884c\u5982\u6df1\u5ea6\u641c\u7d22\u6216\u8005\u662f\u67e5\u627e\u8282\u70b9\uff0c\u66ff\u6362\u8282\u70b9\u4e4b\u7c7b\u7684\u884c\u4e3a\u3002\n\u73b0\u5728\u7684\u95ee\u9898\u662f\uff1a\n\u6211\u60f3\u8981\u4e00\u4e2a\u65b9\u5f0f\u80fd\u5c06\u8fd9\u4e2a\u6811\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316\uff0c\u5e76\u901a\u8fc7\u8bfb\u53d6\u7528\u6237\u8f93\u5165\u5c06\u5176\u8f6c\u6362\u4e3a\u4e00\u4e2a\u6811\u3002\n\u6211\u6700\u5f00\u59cb\u662f\u6253\u7b97\u4ece\u6839\u8282\u70b9\u5411\u53f6\u5b50\u8282\u70b9\u8fdb\u884c\u6784\u5efa\uff0c\u4f46\u6211\u5f88\u5feb\u53d1\u73b0\u8fd9\u4e2a\u65b9\u6cd5\u7684\u4e0d\u53ef\u64cd\u4f5c\u6027\uff1a\u56e0\u4e3a\u6211\u7684\u6811\u4e0d\u662f\u5b8c\u5168\u7684\u4e8c\u53c9\u6811\uff0c\u6709\u5e38\u6570\u548c\u672a\u77e5\u6570\u4e24\u79cd\u6ca1\u6709\u5b50\u8282\u70b9\u6982\u5ff5\u7684\u6811\uff0c\u4ed6\u4eec\u53ea\u6709\u4e00\u4e2a value \uff0c\u800c\u4e14\u7531\u4e8e\u6211\u6709\u4e09\u79cd\u4e0d\u540c\u7c7b\u578b\u7684\u679d\u5e72\u8282\u70b9\uff0c\u6211\u65e0\u6cd5\u4f7f\u7528\u4e00\u4e2a\u7edf\u4e00\u7684\uff0c\u5199\u5728\u57fa\u7c7b\u91cc\u7684 addNode \u65b9\u6cd5\u5728\u8282\u70b9\u751f\u6210\u540e\u5bf9\u5b50\u8282\u70b9\u8fdb\u884c\u64cd\u4f5c\uff0c\u6211\u5fc5\u987b\u4f7f\u7528 if else \u624d\u884c\uff0c\u8fd9\u8fdd\u80cc\u4e86\u6cdb\u578b\u7684\u521d\u8877\uff0c\u4e5f\u5341\u5206\u4e0d\u7075\u6d3b\uff0c\u6240\u4ee5\u6211\u5fc5\u987b\u4ece\u6700\u4e0b\u65b9\u7684\u53f6\u5b50\u8282\u70b9\u5f80\u4e0a\u65b9\u6784\u5efa\u3002\n\u6211\u7684\u6253\u7b97\u662f\uff0c\u5148\u7b5b\u9009\u51fa\u6240\u6709\u7684\u53f6\u5b50\u8282\u70b9\uff0c\u7136\u540e\u50cf\u642d\u91d1\u5b57\u5854\u4e00\u6837\uff0c\u7528 1 \uff0c2 \uff0clist \u4e2a\u8282\u70b9\u5c06\u7b26\u53f7\u6784\u5efa\u51fa\u6765\uff0c\u7136\u540e\u5728\u8fd9\u4e2a\u7b26\u53f7\u4e0a\u518d\u548c\u5176\u4ed6\u7b26\u53f7\u6216\u8005\u8282\u70b9\u4e00\u8d77\u642d\u7b26\u53f7\uff0c\u6700\u540e\u642d\u5230\u6839\u8282\u70b9\u3002\u4f46\u662f\u8fd9\u6709\u4e2a\u95ee\u9898\uff1a\u5f53\u6211\u5728\u4f7f\u7528\u5982 numberEqualsNode \uff0c\u8fd9\u79cd\u5de6\u53f3\u8282\u70b9\u4e00\u4e2a\u662f int \uff0c\u53e6\u4e00\u4e2a\u4e5f\u662f int \uff0c\u8f93\u51fa\u662f bool \u7684\u8282\u70b9\uff0c\u6211\u8be5\u5982\u4f55\u5224\u65ad\u8f93\u5165\u7684 node \u7684\u6cdb\u578b\u662f int \uff1f\u5982\u679c\u4e0d\u5224\u65ad\uff0c\u90a3\u4e48\u5de6\u53f3\u8282\u70b9\u8bbe\u7f6e\u6cdb\u578b\u7684\u610f\u4e49\u4f55\u5728\uff1f\n\u7531\u4e8e java \u7684\u6cdb\u578b\u662f\u5728\u8fd0\u884c\u4e4b\u540e\u4f1a\u88ab\u5220\u6389\u7684\u548c\u6ce8\u91ca\u4e00\u6837\u7684\u7528\u4e8e\u68c0\u67e5\u7f16\u8bd1\u7684\u4e1c\u897f\uff0c\u6240\u4ee5\u6211\u4e0d\u80fd\u76f4\u63a5 if node is node<int>\uff0c\u4f46\u90a3\u6837\u6211\u600e\u4e48\u68c0\u67e5\u8fd9\u4e2a\u8282\u70b9\uff1f

\n

\u5907\u6ce8\uff1a\u65e0\u6cd5\u6362\u8bed\u8a00\uff0c\u6216\u8005\u4f7f\u7528 lua \uff0c\u4f46\u53ef\u4ee5\u4f7f\u7528 kotlin \u548c scala \u3002\u53ef\u4ee5\u6539\u53d8\u4e00\u4e9b\u8bbe\u8ba1\uff0c\u4f46\u4e0d\u80fd\u628a\u6574\u4e2a\u5e95\u5c42\u90fd\u7ed9\u5228\u4e86\u3002

\n" }, { "author": { "url": "member/nnegier", "name": "nnegier", "avatar": "https://cdn.v2ex.com/gravatar/00b9dc80a372050eec8fbfa5200a6186?s=73&d=retro" }, "url": "t/908917", "title": "\u6709\u6ca1\u6709 Kotlin \u8bb2\u534f\u7a0b\u6bd4\u8f83\u597d\u7684\u4e66\u7c4d\u6216\u535a\u5ba2\u8fde\u8f7d", "id": "t/908917", "date_published": "2023-01-14T08:49:46+00:00", "content_html": "

\u6211\u76ee\u524d\u53ea\u641c\u5230\u4e00\u672c\u4e66\u662f\u4e13\u95e8\u8bb2\u534f\u7a0b\u7684\u300a\u6df1\u5165\u7406\u89e3 Kotlin \u534f\u7a0b\u300b\uff0c\u6211\u4f30\u6478\u7740\u6211\u76ee\u524d\u770b\u4e0d\u592a\u61c2\uff0c\u5e0c\u671b\u53ef\u4ee5\u6709\u5176\u5b83\u7684\u63a8\u8350\uff0c\u901a\u8fc7\u7ec3\u4e60\u53ef\u4ee5\u6df1\u5165\u6d45\u51fa\u81ea\u5df1\u5f04\u4e00\u4e9b\u534f\u7a0b\u6846\u67b6\u7684\u90a3\u79cd\u3002

\n" }, { "author": { "url": "member/coderstory", "name": "coderstory", "avatar": "https://cdn.v2ex.com/avatar/3c9c/7f07/178817_large.png?m=1659344747" }, "url": "t/885193", "date_modified": "2022-10-08T03:30:49+00:00", "content_html": "
 fun setValue(variables: Map<String, Any>, value: Any?) {\n val instance = operand.eval(variables) ?: throw NullPointerException(\"instance is null\")\n\n if (instance is LogicList<*>) {\n instance.set(property.key.replace(\"[\", \"\").replace(\"]\", \"\").trim().toInt(), value)\n } else {\n throw IllegalArgumentException(\"\u53d8\u91cf ${(operand as Variable).key} \u4e0d\u662f\u6570\u7ec4\")\n }\n }\n \n
\n

\u4ee3\u7801\u5982\u4e0a instance.set \u65b9\u6cd5 idea \u63d0\u793a\u6211\u7b2c\u4e8c\u4e2a\u53c2\u6570 element \u662f NoThing \u7c7b\u578b \u5bfc\u81f4\u6211 set \u65b9\u6cd5\u65e0\u6cd5\u8c03\u7528

\n
Kotlin: Type mismatch: inferred type is Any? but Nothing was expected\n
\n

\u76f4\u63a5\u7f16\u8bd1 \u62a5\u4e86\u5982\u4e0a\u9519\u8bef instance \u672c\u8eab\u662f Any?\u7c7b\u578b\u7684\uff0c\u7531\u4e8e\u505a\u4e86 null \u6821\u9a8c\uff0c\u6240\u4ee5\u662f Any \u7c7b\u578b\u7684\u3002\nLogicList \u662f ArrayList \u7684\u6269\u5c55\u7c7b\uff0cset \u65b9\u6cd5\u53c8 List \u63d0\u4f9b\u7684\u3002\n\u8fd9\u8fb9\u6211\u4e0d\u592a\u6e05\u695a\u8981\u600e\u4e48\u6539\u4e86\uff0c\u6211\u672c\u8eab\u4e5f\u4e0d\u592a\u61c2 kotlin \u3002

\n", "date_published": "2022-10-08T03:27:41+00:00", "title": "ArrayList.set \u63d0\u793a \u7b2c\u4e8c\u4e2a\u53c2\u6570 element \u7c7b\u578b\u662f NoThing \uff1f", "id": "t/885193" }, { "author": { "url": "member/shuanglinzui", "name": "shuanglinzui", "avatar": "https://cdn.v2ex.com/avatar/c5f3/0263/91498_large.png?m=1611206296" }, "url": "t/883324", "date_modified": "2022-09-27T08:50:37+00:00", "content_html": "

RT\n\u4e0d\u60f3\u5199 java \u4e86\u3002

\n", "date_published": "2022-09-27T08:49:55+00:00", "title": "\u54ea\u4e9b\u516c\u53f8\u540e\u7aef\u7528 kotlin \u5199\u7684", "id": "t/883324" }, { "author": { "url": "member/bootvue", "name": "bootvue", "avatar": "https://cdn.v2ex.com/gravatar/52edce86633f4c335d03998cce737f6e?s=73&d=retro" }, "url": "t/868993", "date_modified": "2022-07-27T05:42:02+00:00", "content_html": "\u5b57\u7b26\u4e32\u8868\u8fbe\u5f0f \"s1 + ( s2 - s3 )\" \u96c6\u5408 s1 s2 s3

kotlin \u4e2d\u600e\u4e48\u8ba9\u9884\u5b9a\u4e49\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a\u8868\u8fbe\u5f0f\u6267\u884c \u5b9e\u73b0\u7c7b\u4f3c js \u4e2d eval ( \"\u8868\u8fbe\u5f0f\" )\u7684\u6548\u679c \u6267\u884c\u5b8c\u8fd4\u56de\u96c6\u5408\u7c7b\u578b\u7684\u7ed3\u679c", "date_published": "2022-07-27T04:26:02+00:00", "title": "kotlin \u8868\u8fbe\u5f0f\u5f15\u64ce", "id": "t/868993" }, { "author": { "url": "member/jeesk", "name": "jeesk", "avatar": "https://cdn.v2ex.com/gravatar/ad011d1d1e836aac8ae7bdc3a5b35c2f?s=73&d=retro" }, "url": "t/862539", "title": "\u6700\u8fd1\u5728\u770b Kotlin \u522b\u4eba\u4e00\u4e9b\u4ee3\u7801\uff0c \u770b\u5230\u5982\u4e0b\u7684\u4ee3\u7801\u60ca\u5446\u4e86", "id": "t/862539", "date_published": "2022-06-27T10:54:17+00:00", "content_html": "```
class Gallery_1(val context: Context) {
private val contentResolver by lazy {
context.contentResolver
}

//
class Album(
val id: String,
val name: String,
var count: LOng= 0,
// ? \u8868\u793a\u53ef\u4ee5\u63a5\u53d7\u7a7a
var uri: Uri? = null,
var file: File? = null
)
```
class \u540e\u9762\u8ddf\u4e0a\u5c0f\u62ec\u53f7\uff0c \u641e\u5f97\u6211\u5b8c\u5168\u4e0d\u77e5\u9053\u8fd9\u662f\u4ec0\u4e48\u610f\u601d\u4e86 \u65e0\u6cd5\u662f java, scala \uff0cgo \u8fd8\u662f js \u90fd\u6ca1\u6709\u8fd9\u7528\u6cd5\uff0ckotlin \u76f4\u63a5\u4e0d\u6309\u5957\u8def\u51fa\u724c\uff0c \u665a\u4e0a\u4e5f\u6ca1\u6709\u67e5\u5230\u8fd9\u4e2a Album \u662f\u4ec0\u4e48\u7528\u6cd5\uff0c \u6709\u6ca1\u6709 kotlin \u7684\u5927\u4f6c\u80fd\u8bb2\u4e00\u8bb2\u3002" }, { "author": { "url": "member/714105382", "name": "714105382", "avatar": "https://cdn.v2ex.com/avatar/76aa/cd44/320068_large.png?m=1532429350" }, "url": "t/830515", "title": "Kotlin \u7684\u534f\u7a0b\u662f\u771f\u534f\u7a0b\u5417\uff1f\u88ab b \u7ad9\u535a\u4e3b\u641e\u8499\u4e86", "id": "t/830515", "date_published": "2022-01-25T07:51:28+00:00", "content_html": "

\u80fd\u505a\u5230\u7c7b\u4f3c golang goroutine \u5b8c\u5168\u4e0d\u963b\u585e\u4efb\u4f55 os thread \u8fdb\u884c io \u4e4b\u7c7b\u7684\u8bbf\u95ee\u5e76\u5728\u5f97\u5230\u7ed3\u679c\u540e\u81ea\u52a8\u628a\u534f\u7a0b\u6302\u8f7d\u5230\u7ebf\u7a0b\u7ee7\u7eed\u6267\u884c\uff1f

\n

\u89c6\u9891\u4e0a\u8bf4\u4e0d\u80fd\uff1a [ [\u7801\u4e0a\u5f00\u5b66] \u5230\u5e95\u4ec0\u4e48\u662f\u300c\u975e\u963b\u585e\u5f0f\u300d\u6302\u8d77\uff1f\u534f\u7a0b\u771f\u7684\u6bd4\u7ebf\u7a0b\u66f4\u8f7b\u91cf\u7ea7\u5417\uff1f-\u54d4\u54e9\u54d4\u54e9] https://b23.tv/qIkWUmo

\n" }, { "author": { "url": "member/sucvia", "name": "sucvia", "avatar": "https://cdn.v2ex.com/gravatar/653f6f01cc90232320a3242ee1bd7cba?s=73&d=retro" }, "url": "t/827831", "title": "\u6709\u6ca1\u6709\u4eba\u80fd\u5e2e\u6211\u89e3\u91ca\u4e00\u4e0b,\u8fd9\u91cc\u9762\u7684\u4ee3\u7801.\u5982\u679c\u6211\u521b\u5efa\u4e00\u4e2a\u65b0\u7a97\u53e3,\u6309\u7167\u8fd9\u4e2a\u903b\u8f91,\u600e\u4e48\u663e\u793a\u51fa\u6765", "id": "t/827831", "date_published": "2022-01-12T07:27:21+00:00", "content_html": "

package com.example.myapplication2

\n

import android.os.Bundle\nimport com.google.android.material.snackbar.Snackbar\nimport androidx.appcompat.app.AppCompatActivity\nimport androidx.navigation.findNavController\nimport androidx.navigation.ui.AppBarConfiguration\nimport androidx.navigation.ui.navigateUp\nimport androidx.navigation.ui.setupActionBarWithNavController\nimport android.view.Menu\nimport android.view.MenuItem\nimport com.example.myapplication2.databinding.ActivityMainBinding

\n

class MainActivity : AppCompatActivity() {

\n
private lateinit var appBarConfiguration: AppBarConfiguration //\u521b\u5efa 2 \u4e2a\u53d8\u91cf\nprivate lateinit var binding: ActivityMainBinding\n\noverride fun onCreate(savedInstanceState: Bundle?) {\n super.onCreate(savedInstanceState)\n\n binding = ActivityMainBinding.inflate(layoutInflater)\n setContentView(binding.root)\n\n setSupportActionBar(binding.toolbar)\n\n val navCOntroller= findNavController(R.id.nav_host_fragment_content_main)\n appBarCOnfiguration= AppBarConfiguration(navController.graph)\n setupActionBarWithNavController(navController, appBarConfiguration)\n\n binding.fab.setOnClickListener { view ->\n Snackbar.make(view, \"Replace with your own action\", Snackbar.LENGTH_LONG)\n .setAction(\"Action\", null).show()\n }\n}\n\noverride fun onCreateOptionsMenu(menu: Menu): Boolean {\n // Inflate the menu; this adds items to the action bar if it is present.\n menuInflater.inflate(R.menu.menu_main, menu)\n return true\n}\n\noverride fun onOptionsItemSelected(item: MenuItem): Boolean {\n return when (item.itemId) {\n R.id.action_settings -> true\n else -> super.onOptionsItemSelected(item)\n }\n}\n\noverride fun onSupportNavigateUp(): Boolean {\n val navCOntroller= findNavController(R.id.nav_host_fragment_content_main)\n return navController.navigateUp(appBarConfiguration)\n || super.onSupportNavigateUp()\n}\n
\n

}

\n

\u6211\u662f\u4e2a\u840c\u65b0,\u521a\u5b66 Kotlin,\u6709\u6ca1\u6709\u63a8\u8350\u7fa4\u4e00\u8d77\u5b66\u4e60?

\n

\u6309\u7167\u4ee5\u4e0a\u4ee3\u7801,\u5982\u679c\u6211\u6709\u4e2a\u6309\u94ae id=\"create_button\" ,\u6309\u4e0b\u8f7d\u5165 test_window.xml \u7a97\u53e3.\ntest_window.xml \u91cc\u9762\u6709\u4ec0\u4e48\u8bb2\u7a76\u5417?

\n" }, { "author": { "url": "member/Leviathann", "name": "Leviathann", "avatar": "https://cdn.v2ex.com/gravatar/d3b22910a49ecf620ab67790d7f594eb?s=73&d=retro" }, "url": "t/807895", "title": "\u600e\u4e48\u89e3\u51b3 public reified \u51fd\u6570\u4f1a\u8981\u6c42\u6240\u6709\u7528\u5230\u7684\u4f9d\u8d56\u90fd\u662f public \u7684\u95ee\u9898", "id": "t/807895", "date_published": "2021-10-14T13:43:02+00:00", "content_html": "\u6bd4\u5982\u6709\u4e2a object: JsonUtils\uff0c\u5176\u4e2d\u5305\u542b\u4e00\u4e2a\u5b9a\u5236\u8fc7\u7684 jackson \u7684 objectMapper
\u7136\u540e \u8fd9\u4e2a JsonUtils \u6709\u4e2a\u53cd\u5e8f\u5217\u5316\u65b9\u6cd5\u662f\u66b4\u9732\u7684\u4e00\u4e2a reified \u51fd\u6570\uff0c\u7136\u540e\u5185\u90e8\u8c03\u7528 objectMapper \u7684 readValue \u65b9\u6cd5
\u4f46\u95ee\u9898\u662f reified \u51fd\u6570\u7684\u6240\u6709\u4f9d\u8d56\u90fd\u5fc5\u987b\u662f public\uff0c\u5bfc\u81f4\u8fd9\u4e2a\u5185\u90e8\u7684 objectMapper \u4e5f\u5fc5\u987b\u662f public

\u867d\u7136\u63d0\u4ea4\u4ee3\u7801\u90fd\u6709 code review \u80af\u5b9a\u6ca1\u4eba\u4f1a\u53bb\u5728\u522b\u7684\u5730\u65b9\u4fee\u6539\u8fd9\u4e2a objectmapper\uff0c\u4f46\u662f\u603b\u611f\u89c9\u602a\u602a\u7684

\u6216\u8005\u8bf4 kotlin \u4e3a\u5565\u4e0d\u80fd\u533a\u5206\u4e00\u4e0b\u7f16\u8bd1\u65f6\u7684 private \u548c\u8fd0\u884c\u65f6\u7684 private" }, { "author": { "url": "member/Leviathann", "name": "Leviathann", "avatar": "https://cdn.v2ex.com/gravatar/d3b22910a49ecf620ab67790d7f594eb?s=73&d=retro" }, "url": "t/793491", "title": "Result \u7684\u65b9\u5f0f\u5904\u7406\u5f02\u5e38\u7528\u7684\u591a\u5417\uff0c\u6211\u770b\u4e86\u4e0b\u597d\u50cf\u548c\u6bd4\u8f83\u53d7\u597d\u8bc4\u7684 rust result \u7528\u6cd5\u5dee\u4e0d\u591a", "id": "t/793491", "date_published": "2021-08-03T17:44:15+00:00", "content_html": "\u4f46\u662f\u7f51\u4e0a\u641c\u4e86\u4e0b\u597d\u50cf\u5b8c\u5168\u6ca1\u4ec0\u4e48\u70ed\u5ea6" }, { "author": { "url": "member/zengqz", "name": "zengqz", "avatar": "https://cdn.v2ex.com/gravatar/7f1a5c4da5523e9392a5e9c9e49fb045?s=73&d=retro" }, "url": "t/788273", "title": "Kotlin \u66f4\u6362\u4e86\u65b0 logo\uff1a\u66f4\u52a0\u7acb\u4f53\u3001\u66f4\u52a0\u6e05\u6670", "id": "t/788273", "date_published": "2021-07-08T04:21:05+00:00", "content_html": "

\"\"

\n

\u8be6\u89c1\u7ffb\u8bd1\u62a5\u544a\uff1a\u91cd\u65b0\u8bbe\u8ba1\u7684 Kotlin Logo

\n" }, { "author": { "url": "member/zengqz", "name": "zengqz", "avatar": "https://cdn.v2ex.com/gravatar/7f1a5c4da5523e9392a5e9c9e49fb045?s=73&d=retro" }, "url": "t/785730", "title": "Kotlin 1.5.20 \u53d1\u5e03\u4e86\uff5e\u5feb\u6765\u770b\u770b\u65b0\u7279\u6027", "id": "t/785730", "date_published": "2021-06-25T03:57:27+00:00", "content_html": "

\u53ef\u4ee5\u652f\u6301\u76f4\u63a5\u8c03\u7528 java lombok \u751f\u6210\u7684\u4ee3\u7801\u4e86

\n

\u4e2d\u6587\u7248\u65b0\u7279\u6027\u4e00\u89c8

\n" }, { "author": { "url": "member/yazinnnn", "name": "yazinnnn", "avatar": "https://cdn.v2ex.com/gravatar/a524fa152f42c833f1e93100e07a12af?s=73&d=retro" }, "url": "t/785309", "title": "\u5173\u4e8e kotlin \u5904\u7406\u591a\u4e2a\u53ef\u7a7a\u7c7b\u578b\u7684\u53d8\u91cf\u7684\u95ee\u9898", "id": "t/785309", "date_published": "2021-06-23T06:41:22+00:00", "content_html": "
class A\nclass B\n\nval a: A? = null\nval b: B? = null\n\nfun foo(a: A, b: B) {\n println(a)\n println(b)\n}\n\nsuspend fun main() {\n a?.let { b?.let { foo(a, b) } }\n}\n
\n

\u9664\u4e86a?.let { b?.let { foo(a, b) } }\u8fd9\u79cd\u5f62\u5f0f\u548c if a!= null && b!= null,\u8fd8\u6709\u5565\u5176\u4ed6\u597d\u529e\u6cd5\u5417?

\n

\u73b0\u5728\u627e\u5230\u4e00\u4e2a arrow \u5e93\u53ef\u4ee5\u7528 option dsl \u5b9e\u73b0\u6bd4\u8f83\u6f02\u4eae\u7684\u5305\u88c5

\n
option {\n\tfoo(a.bind(), b.bind())\n}\n
\n" }, { "author": { "url": "member/coderstory", "name": "coderstory", "avatar": "https://cdn.v2ex.com/avatar/3c9c/7f07/178817_large.png?m=1659344747" }, "url": "t/777439", "title": "\u6c42\u89e3\u8fd9\u4e2a eval \u51fd\u6570\u8fd4\u56de\u503c\u4e3a\u4ec0\u4e48\u662f\u4e2a lambda\uff1f\u600e\u4e48\u624d\u80fd\u62ff\u5230\u503c\uff1f \u200b\u200b\u200b", "id": "t/777439", "date_published": "2021-05-17T07:24:46+00:00", "content_html": "
 class Min {\n override fun eval(variables: Map<String, Any>): Any = {\n val values = parameters.map { it.eval(variables) }\n min(values[0] as Double, values[1] as Double)\n }\n }\n
\n

\u8fd9\u4e2a\u51fd\u6570\u554a\u5728 IDEA \u7684 evaluate \u4e2d\u6267\u884c \u8fd4\u56de\u4e86 Min$eval$1 \u7c7b\u7684\u5b9e\u4f8b ()-> Kotlin.Double

\n
 override fun eval(variables: Map<String, Any>): Any {\n val values = parameters.map { it.eval(variables) }\n return min(values[0] as Double, values[1] as Double)\n }\n
\n

\u6211\u628a\u5b83\u6539\u6210\u4e86\u666e\u901a\u7684 return \u51fd\u6570\u5c31\u6ca1\u8fd9\u4e2a\u95ee\u9898\u4e86 \u53ef\u4ee5\u8fd4\u56de\u5177\u4f53\u7684\u503c

\n

\u6c42\u89e3\u8fd9\u79cd\u76f4\u63a5\u7b49\u4e8e\u53f7\u8d4b\u503c\u7684\u64cd\u4f5c \u548c\u666e\u901a\u51fd\u6570\u4f7f\u7528 return \u7684\u64cd\u4f5c \u6709\u4ec0\u4e48\u533a\u522b

\n" }, { "author": { "url": "member/Leviathann", "name": "Leviathann", "avatar": "https://cdn.v2ex.com/gravatar/d3b22910a49ecf620ab67790d7f594eb?s=73&d=retro" }, "url": "t/771382", "title": "kotlin lazy \u5f62\u5f0f\u7684 grouping and mapping \u5e94\u8be5\u600e\u4e48\u5199\uff0c sequence \u91cc grouping + aggregate \u600e\u4e48\u6bd4 Java stream \u8fd8\u590d\u6742\u5f97\u591a", "id": "t/771382", "date_published": "2021-04-17T19:04:21+00:00", "content_html": "

\u662f\u4e0d\u662f\u6211\u59ff\u52bf\u4e0d\u5bf9\uff0c\u6709\u6ca1\u6709\u66f4\u597d\u7684\u5199\u6cd5\uff1f

\n
val kotlin = \"ABCDEF\".asSequence()\n .groupingBy {\n println(\"grouping\")\n it.toInt() / 10\n }\n .aggregate { _, accumulator: MutableList<String>?, element, first ->\n println(\"aggregate\")\n if (first) {\n val tmp = MutableList(0) { \"\" }\n tmp.add(element.toString() + \"X\")\n tmp\n } else {\n accumulator!!.add(element.toString() + \"X\")\n accumulator\n }\n }\nprintln(kotlin)\n\n\nval java = \"ABCDEF\".toList().stream()\n .collect(\n Collectors.groupingBy(\n { println(\"java grouping\"); it.toInt() / 10 },\n Collectors.mapping({ println(\"java mapping\"); it.toString() + \"X\" }, Collectors.toList())\n )\n )\nprintln(java)\n\n\n
\n" }, { "author": { "url": "member/Trinity888", "name": "Trinity888", "avatar": "https://cdn.v2ex.com/avatar/6df3/fb2c/248849_large.png?m=1696906163" }, "url": "t/768559", "title": "\u5f3a\u5927\u7684 v2ex\uff0c\u5927\u5bb6\u64c5\u957f Kotlin\uff0c webview \u4ea4\u4e92\u7684\u4f19\u4f34\uff0c\u6765\u4e00\u6ce2", "id": "t/768559", "date_published": "2021-04-07T00:54:06+00:00", "content_html": "\u4e00\u4e2a\u5b89\u5353\u9879\u76ee\uff0c\u53ea\u5f00\u53d1\u524d\u7aef\uff0c\u9884\u7b97\u53ef\u8c08\uff0c\u505a\u8fc7 Tcp Server \u7684\u4f18\u5148" }, { "author": { "url": "member/Leviathann", "name": "Leviathann", "avatar": "https://cdn.v2ex.com/gravatar/d3b22910a49ecf620ab67790d7f594eb?s=73&d=retro" }, "url": "t/768535", "title": "springboot kotlin \u548c Java \u6df7\u7f16\uff0c json \u5e8f\u5217\u5316\u7528\u54ea\u4e2a\u6bd4\u8f83\u597d", "id": "t/768535", "date_published": "2021-04-06T17:28:57+00:00", "content_html": "\u6253\u7b97\u91cd\u6784\u9879\u76ee\u7684\u540e\u7aef\u5e76\u9010\u6b65\u8fc1\u79fb\u5230 kotlin
\u5b98\u65b9\u7684 kotlinx.serialization \u6709\u5751\u5417" }, { "author": { "url": "member/naoh1000", "name": "naoh1000", "avatar": "https://cdn.v2ex.com/avatar/de4b/a584/507085_large.png?m=1610340340" }, "url": "t/762949", "date_modified": "2021-03-18T11:17:49+00:00", "content_html": "\u4ee5\u524d\u8bd5\u8fc7\u7528 React Native \u8fd9\u79cd JS \u591a\u7aef\u6846\u67b6\u5f00\u53d1\u5e94\u7528\uff0c\u53d1\u73b0\u8fd0\u884c\u6709\u4e9b\u5361\u987f\u4e14\u4e0d\u6613\u52a0\u5165\u81ea\u7136\u7684\u8fc7\u6e21\u52a8\u753b\uff0c\u636e\u8bf4 App Store \u57fa\u672c\u4e0d\u63a8\u8350\u8fd9\u6837\u7684\u5e94\u7528\uff0c\u60f3\u77e5\u9053 Kotlin \u4f5c iOS \u5f00\u53d1\u662f\u4e0d\u662f\u5dee\u4e0d\u591a\u7684\u60c5\u51b5\u3002", "date_published": "2021-03-18T11:13:56+00:00", "title": "\u6709\u54ea\u4e9b\u77e5\u540d iOS \u5e94\u7528\u662f\u7eaf Kotlin \u5f00\u53d1\u7684\uff1f", "id": "t/762949" }, { "author": { "url": "member/yazinnnn", "name": "yazinnnn", "avatar": "https://cdn.v2ex.com/gravatar/a524fa152f42c833f1e93100e07a12af?s=73&d=retro" }, "url": "t/726873", "title": "[\u534f\u7a0b\u9012\u5f52\u95ee\u9898\u8bf7\u6559]", "id": "t/726873", "date_published": "2020-11-18T13:43:07+00:00", "content_html": "

\u62ff\u5b9e\u9645\u4e1a\u52a1\u8bf4\n\u4ee5\u9489\u9489\u63a5\u53e3\u4e2d\u7684\u8ddf\u90e8\u95e8 id [ 1 ] \u4e3a\u5f00\u59cb\uff0c\u9012\u5f52\u51fa\u516c\u53f8\u8be6\u7ec6\u7684\u7ec4\u7ec7\u67b6\u6784

\n
\nsuspend fun getDepart(){\n\tfun getSubDepart(pid):List<Department>{\n\t\tval subList:List<departId> = dingApi.getSubDepartList(pid)\n\t\treturn subList.map{\n\t\t\tDepartment(it,getSubDepart(it))\n\t\t}\n\t}\n\treturn Department(1,getSubDepart(1))\n}\n\ndata class Department(val departId,val subList:List<Department>) //sublist \u662f\u4e0b\u5c5e\u90e8\u95e8\u5217\u8868 \n\n\n
\n

\u4e1a\u52a1\u5927\u6982\u5982\u6b64\u63cf\u8ff0\uff0c\u540c\u6b65\u72b6\u6001\u4e0b\u5f88\u7b80\u5355\uff0c\u8bf7\u95ee\u534f\u7a0b\u8981\u600e\u4e48\u5b9e\u73b0\u5462\uff1f

\n

\u6211\u7528 withcontext \uff08\uff09\u5305\u88f9\u8ffd\u9489\u9489 api\uff0c\u7ed3\u679c build \u65f6\u65e0\u6cd5\u901a\u8fc7\uff0c\u62a5\ncall to 'resume' before 'invoke' with coroutine

\n

\u8bf7\u95ee\u6709\u5927\u4f6c\u80fd\u5e2e\u52a9\u4e00\u4e0b\u5417\uff1f

\n" }, { "author": { "url": "member/ghz666", "name": "ghz666", "avatar": "https://cdn.v2ex.com/gravatar/d83999ae66c46f459adbb39a5e5e20d2?s=73&d=retro" }, "url": "t/715050", "title": "kotlin \u6253\u5305\u95ee\u9898", "id": "t/715050", "date_published": "2020-10-14T17:17:56+00:00", "content_html": "

kotlin \u840c\u65b0\u4e00\u679a\uff0c\u6700\u8fd1\u5728\u7528 mirai \u505a qq \u673a\u5668\u4eba\uff0c\u78b0\u4e0a\u4e00\u4e2a\u6253\u5305\u7684\u95ee\u9898\u3002\u524d\u8fb9\u52a0\u4e0a susbend \u4e4b\u540e\u5c31\u4e0d\u80fd\u6253\u5305\u4e86\u3002\u3002\u3002\u3002\u53bb\u6389\u4e4b\u540e\u5c31\u53c8\u80fd\u4e86\u3002\u6709\u6ca1\u6709\u5927\u4f6c\u77e5\u9053\u548b\u56de\u4e8b\uff1f\n\u622a\u56fe\uff1a

\n
\n\n\n" }, { "author": { "url": "member/darksheep9527", "name": "darksheep9527", "avatar": "https://cdn.v2ex.com/avatar/c5b8/6b23/503523_large.png?m=1756104454" }, "url": "t/712514", "title": "\u6c42\u63a8\u8350 kotlin \u5b89\u5353\u5f00\u53d1\u6559\u7a0b", "id": "t/712514", "date_published": "2020-10-04T10:44:08+00:00", "content_html": "

\u6c42\u52a9\u6b63\u6587

\n

\u697c\u4e3b\u662f\u4e00\u679a\u83dc\u9e21\u5927\u5b66\u751f\uff0c\u5b89\u5353\u5f00\u53d1\u7684\u8001\u5e08\u51b3\u5b9a\u4ece\u8fd9\u5b66\u671f\u5f00\u59cb\u7528 kotlin \u6559\u5b89\u5353\u5f00\u53d1\n\u697c\u4e3b\u5b89\u5353\u5f00\u53d1\u548c kotlin \u90fd\u6ca1\u63a5\u89e6\u8fc7\uff0c\u6240\u4ee5\u60f3\u81ea\u5df1\u627e\u4e00\u4efd\u6559\u7a0b\u8bfe\u5916\u5b66\u4e60\uff0c\u6c42\u6709\u4e86\u89e3\u7684\u5927\u4f6c\u4ecb\u7ecd\u4e00\u4efd\u6bd4\u8f83\u65b0\u7684

\n
\n

\u56e0\u4e3a\u88ab\u4e00\u672c\u8001\u4e66\u6298\u817e\u4e86\u597d\u4e45

\n
\n

\u83dc\u9e21\u5410\u69fd

\n

\u641c\u5230\u4e86\u5f88\u591a\u4eba\u5b89\u5229\u7684 Kotlin\tfor\tandroid\tdevelopers \u7684\u4e2d\u6587\u7248\n\u7136\u540e\u53d1\u73b0\u7248\u672c\u592a\u8001\u4e86\uff0c\u91cc\u9762\u7528\u7684 anko \u5e93\u73b0\u5728\u5df2\u7ecf\u5e9f\u5f03\u4e86\u4f46\u662f\u4e5f\u8fd8\u80fd\u7528\nRecyclerView \u5e93\u5df2\u7ecf\u4ece 7 \u53d8\u6210\u4e86\u5b89\u5353 x

\n
val\tforecastList=findViewById(R.id.forecast_list) as RecyclerView\n
\n
\n

\u6539\u7528 x \u4e4b\u540e\uff0cfindviewbyid \u53c8\u62a5\u9519

\n
\n
\n

Inspection info: This inspection reports findviewByld calls with type casts which can be converted to findViewByld with a type parameter from Android 8.0(API level 26)

\n
\n

\"image-20201004183420429\"

\n" }, { "author": { "url": "member/300", "name": "300", "avatar": "https://cdn.v2ex.com/avatar/55fe/29e6/116124_large.png?m=1720510511" }, "url": "t/699161", "title": "Kotlin 1.4 Released", "id": "t/699161", "date_published": "2020-08-18T01:24:30+00:00", "content_html": "

https://blog.jetbrains.com/zh-hans/kotlin/2020/08/kotlin-1-4-released-with-a-focus-on-quality-and-performance-zh/

\n" }, { "author": { "url": "member/yazinnnn", "name": "yazinnnn", "avatar": "https://cdn.v2ex.com/gravatar/a524fa152f42c833f1e93100e07a12af?s=73&d=retro" }, "url": "t/696198", "title": "\u8bf7\u6559\u4e00\u4e0b kotlin json \u5e8f\u5217\u5316\u53ca\u914d\u5408 data class \u7684\u6b63\u786e\u59ff\u52bf", "id": "t/696198", "date_published": "2020-08-06T08:21:15+00:00", "content_html": "

jackson \u53ef\u4ee5\u76f4\u63a5 decode jsonString \u6210 Any \u9700\u8981\u81ea\u5df1\u5f3a\u8f6c\u6210 jsonObject \u6216\u8005 jsonArray\n\u53ef\u4ee5\u8f6c\u6210\u666e\u901a class \u5b9e\u4f53\uff0c\u4e0d\u80fd\u8f6c\u6210 data class

\n

Fastjson \u60c5\u51b5\u7c7b\u4f3c

\n

\u7f51\u4e0a\u641c\u4e86\u4e00\u4e0b jackson \u9700\u8981\u5f15\u5165 kotlin module \u548c\u5927\u91cf\u6ce8\u89e3\u914d\u5408\u624d\u80fd\u4f7f\u7528 data class

\n

\u8bf7\u95ee\u6709\u5565\u65b9\u4fbf\u7684\u8f6e\u5b50\u53ef\u4ee5\u7528\u4e48\uff1f

\n" }, { "author": { "url": "member/lululau", "name": "lululau", "avatar": "https://cdn.v2ex.com/avatar/1352/d2eb/15170_large.png?m=1751341400" }, "url": "t/691633", "title": "\u5404\u4f4d\u516c\u53f8\u9879\u76ee\u540e\u7aef\u6709\u7528 Kotlin + Spring \u7684\u5417\uff0c DB \u5c42\u6846\u67b6\u9009\u7528\u7684\u4ec0\u4e48\uff1f", "id": "t/691633", "date_published": "2020-07-20T08:41:14+00:00", "content_html": "

JPA? Hibernate? MyBatis? Exposed?

\n" }, { "author": { "url": "member/iseki", "name": "iseki", "avatar": "https://cdn.v2ex.com/gravatar/721d70c80ade836659693895ef66bbff?s=73&d=retro" }, "url": "t/689648", "title": "\u614c\u7684\u4e00\u6279\uff0c Kotlin \u8fd9\u4e48\u4f18\u96c5\u7684\u8bed\u8a00\u4e3a\u4ec0\u4e48\u4e0d\u706b\u5462", "id": "t/689648", "date_published": "2020-07-13T09:10:17+00:00", "content_html": "

\u771f\u662f\uff0c\u4e24\u5e74\u6ca1\u5199 Java \u4e86\uff0c\u4e4b\u524d\u5199\u4e86\u4e24\u793c\u62dc Java \u6ca1\u7ed9\u6211\u6025\u6b7b\uff0c\u624b\u901f\u8fdc\u8fdc\u8ddf\u4e0d\u4e0a\u8111\u5b50\u7684\u901f\u5ea6\u3002\u3002\u3002\n\u4f46\u662f\u770b\u770b\u793e\u533a\uff0c\u6709\u4e00\u79cd\u4e0d\u6e29\u4e0d\u706b\u7684\u611f\u89c9\u5462\uff0c\u614c\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7

\n" }, { "author": { "url": "member/fanck0605", "name": "fanck0605", "avatar": "https://cdn.v2ex.com/gravatar/3f57b83dedfeefe03c7bd9ab0c0623ba?s=73&d=retro" }, "url": "t/688067", "date_modified": "2020-07-07T15:55:44+00:00", "content_html": "

\u5728 java \u91cc\uff0c\u6211\u4e00\u822c\u7528\u53cd\u5c04\u904d\u5386\u6240\u6709 Field\uff0c\u5e76\u67e5\u770b\u662f\u5426\u4e3a null

\n
Example example = new Example();\n\n// \u8fd9\u91cc\u89e3\u6790\u4e00\u4e9b\u6587\u672c\u5e76\u7ed9 example \u7684\u6210\u5458\u53d8\u91cf\u8d4b\u503c\n// do something...\n\n// \u68c0\u6d4b\u662f\u5426\u6240\u6709\u53d8\u91cf\u90fd\u88ab\u521d\u59cb\u5316\nField[] fields = Example.class.getFields()\nfor (Field field : fields) {\n try {\n \tObject o = field.get(example);\n if (o == null) {\n throw new Exception()\uff1b\n }\n } catch (IllegalAccessException ignored) {\n }\n}\n
\n

kotlin \u4ee3\u7801\u4e2d\uff0c\u6240\u6709\u6210\u5458\u53d8\u91cf\u90fd\u7528\u4e86 lateinit \u4fee\u9970\u7b26\uff0c\n\u90a3\u6709\u6ca1\u6709\u7c7b\u4f3c\u7684\u65b9\u6cd5\u53ef\u4ee5\uff0c\u68c0\u6d4b\u6240\u6709\u53d8\u91cf\u662f\u5426\u88ab initialized

\n", "date_published": "2020-07-07T15:49:06+00:00", "title": "Kotlin \u5982\u4f55\u68c0\u6d4b\u6240\u6709 lateinit \u7684 field \u662f\u5426\u521d\u59cb\u5316", "id": "t/688067" }, { "author": { "url": "member/q13859601", "name": "q13859601", "avatar": "https://cdn.v2ex.com/gravatar/15d97f9fd5fdd18eaf4ca172fe475c9e?s=73&d=retro" }, "url": "t/683450", "title": "\u521d\u5165 kotlin\uff0c\u6e90\u7801\u627e\u4e0d\u89c1\u6c42\u6559", "id": "t/683450", "date_published": "2020-06-21T03:56:34+00:00", "content_html": "
fun main() {\n val numbersMap = mutableMapOf(\"one\" to 1, \"two\" to 2, \"three\" to 3, \"threeAgain\" to 3)\n numbersMap.keys.remove(\"one\")\n println(numbersMap)\n numbersMap.values -= 3\n println(numbersMap)\n numbersMap.values.remove(3)\n println(numbersMap)\n}\n
\n

\u5bf9\u4e8enumbersMap.values -= 3 \u8fd9\u4e2a-=\u7684\u8fd0\u7b97\u7b26\u91cd\u8f7d\u7684\u6e90\u7801\u5728\u54ea\u91cc\u5462\uff0c\u96be\u9053\u662f native \u4e48\nide \u91cc\u9762\u70b9\u4e86\u534a\u5929\u90fd\u662f MutableCollection \u7684 minusAssign \u65b9\u6cd5\uff0c\u4f46\u662f\u5e76\u4e0d\u6e05\u695a\u8fd9\u4e2a\u5185\u90e8\u7684 values:MutableCollection \u7684-=\u7684\u91cd\u5199\u5982\u4f55\u5173\u8054\u5230 map \u7684 entry \u7684\u5220\u9664\u7684

\n

\u6c42\u5927\u795e\u6307\u5bfc:D

\n" }, { "author": { "url": "member/honglei92", "name": "honglei92", "avatar": "https://cdn.v2ex.com/avatar/d5a8/ef82/406489_large.png?m=1581494448" }, "url": "t/673809", "title": "libcore.reflect.parameterizedtypeimpl cannot be cast to Java .lang.clas \u8fd9\u4e2a\u9519\u8bef \u6211\u771f\u662f\u83ab\u540d\u5176\u5999", "id": "t/673809", "date_published": "2020-05-20T15:40:22+00:00", "content_html": "

1java \u65b9\u6cd5\npublic void getUploadConfig(String uploadJson, final RxResultCallback<TMResponse> callBack)

\n

2TMRespnse \u7c7b \u662f\u6cdb\u578b\u7c7b public class TMResponse<T>

\n

3 \u5728 kotlin \u4e2d\u4f7f\u7528 getUploadConfig(\"111\", object : RxResultCallback<TMResponse<Any>>()

\n

\u5c31\u62a5 \u4e0a\u9762\u7684\u9519\uff0cobject : RxResultCallback<TMResponse<Any>>() \u8fd9\u91cc\u5e94\u8be5\u600e\u4e48\u5199 \u5462\uff1f

\n" } ] } ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86