{"blog_title":"tyamaguc07's hatenablog","type":"rich","image_url":null,"blog_url":"https://tyamaguc07.hatenablog.com/","published":"2024-12-27 01:31:44","title":"kotlin\u306e Iterable<T>.distinct() \u3092\u773a\u3081\u3066\u6c17\u4ed8\u3044\u305f\u3001\u300c\u5b9f\u614b\u3068\u3057\u3066\u306e\u53ef\u5909\u300d\u3068\u300c\u578b\u3068\u3057\u3066\u306e\u4e0d\u5909\u300d","url":"https://tyamaguc07.hatenablog.com/entry/2024/12/27/013144","author_name":"tyamaguc07","categories":[],"provider_url":"https://hatena.blog","author_url":"https://blog.hatena.ne.jp/tyamaguc07/","version":"1.0","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftyamaguc07.hatenablog.com%2Fentry%2F2024%2F12%2F27%2F013144\" title=\"kotlin\u306e Iterable&lt;T&gt;.distinct() \u3092\u773a\u3081\u3066\u6c17\u4ed8\u3044\u305f\u3001\u300c\u5b9f\u614b\u3068\u3057\u3066\u306e\u53ef\u5909\u300d\u3068\u300c\u578b\u3068\u3057\u3066\u306e\u4e0d\u5909\u300d - tyamaguc07&#39;s hatenablog\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","provider_name":"Hatena Blog","height":"190","width":"100%","description":"list.toSet().size \u3068 list.distinct().size \u306f\u540c\u3058\u7d50\u679c\u306b\u306a\u308b\u3002 \u3053\u306e\u9055\u3044\u306f\u4f55\u3067\u3042\u308d\u3046\u304b\uff1f \u8abf\u3079\u3066\u307f\u308b\u3068Stack overflow\u306b\u8a18\u4e8b\u304c\u3042\u3063\u305f\u3002 stackoverflow.com distinct() \u306f\u5185\u90e8\u7684\u306b toSet() \u3057\u3066\u3044\u308b\u3068\u306e\u3053\u3068\u3060\u3002 \u307b\u307b\u30fc\u3068\u601d\u3044\u5b9f\u88c5\u3092\u898b\u306b\u884c\u3063\u305f\u3002 public fun <T> Iterable<T>.distinct(): List<T> { return this.toMutableSet().toList() } toSet() \u3067\u306f\u306a\u304f toMutableSet() \u3067\u306f\u3042\u308b\u304c\u3001\u78ba\u304b\u306bSet\u306b\u5909\u63db\u3059\u308b\u3053\u3068\u3067\u91cd\u8907\u2026"}