<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>9.1.1.8 获取 on 编程那些事儿</title><link>https://before80.github.io/prgms/Kotlin/libraryguides/9.1-Standardlibrary/9.1.1-Collections/9.1.1.8-Retrieve/</link><description>Recent content in 9.1.1.8 获取 on 编程那些事儿</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Sun, 13 Sep 2026 18:20:56 +0800</lastBuildDate><atom:link href="https://before80.github.io/prgms/Kotlin/libraryguides/9.1-Standardlibrary/9.1.1-Collections/9.1.1.8-Retrieve/index.xml" rel="self" type="application/rss+xml"/><item><title>9.1.1.8.1 获取集合的一部分</title><link>https://before80.github.io/prgms/Kotlin/libraryguides/9.1-Standardlibrary/9.1.1-Collections/9.1.1.8-Retrieve/9.1.1.8.1-CollectionParts/</link><pubDate>Sun, 13 Sep 2026 08:50:47 +0800</pubDate><guid>https://before80.github.io/prgms/Kotlin/libraryguides/9.1-Standardlibrary/9.1.1-Collections/9.1.1.8-Retrieve/9.1.1.8.1-CollectionParts/</guid><description>&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://kotlinlang.org/docs/collection-parts.html"&gt;https://kotlinlang.org/docs/collection-parts.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="91181-获取集合的一部分"&gt;9.1.1.8.1 获取集合的一部分&lt;/h1&gt;
&lt;p&gt;Kotlin 标准库包含用于获取集合一部分的扩展函数。这些函数提供了多种为结果集合选择元素的方式：显式列出它们的位置、指定结果大小等等。&lt;/p&gt;</description></item><item><title>9.1.1.8.2 获取单个元素</title><link>https://before80.github.io/prgms/Kotlin/libraryguides/9.1-Standardlibrary/9.1.1-Collections/9.1.1.8-Retrieve/9.1.1.8.2-CollectionElements/</link><pubDate>Sun, 13 Sep 2026 08:50:47 +0800</pubDate><guid>https://before80.github.io/prgms/Kotlin/libraryguides/9.1-Standardlibrary/9.1.1-Collections/9.1.1.8-Retrieve/9.1.1.8.2-CollectionElements/</guid><description>&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://kotlinlang.org/docs/collection-elements.html"&gt;https://kotlinlang.org/docs/collection-elements.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="91182-获取单个元素"&gt;9.1.1.8.2 获取单个元素&lt;/h1&gt;
&lt;p&gt;Kotlin 集合提供了一组用于从集合中获取单个元素的函数。本页描述的函数对列表和集都适用。&lt;/p&gt;
&lt;p&gt;正如&lt;a href="../../9.1.1.1-CollectionsOverview/"&gt;列表的定义&lt;/a&gt;所说，列表是有序集合。因此，列表的每个元素都有可用于引用的位置。除本页描述的函数之外，列表还提供了更多按索引获取和搜索元素的方式。更多细节请参阅 &lt;a href="../../9.1.1.9-Operationsandoperators/9.1.1.9.4-ListOperations/"&gt;List 特有操作&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;而按&lt;a href="../../9.1.1.1-CollectionsOverview/"&gt;定义&lt;/a&gt;，集不是有序集合。不过 Kotlin 的 &lt;code&gt;Set&lt;/code&gt; 会以某种顺序存储元素。这可能是插入顺序（在 &lt;code&gt;LinkedHashSet&lt;/code&gt; 中）、自然排序顺序（在 &lt;code&gt;SortedSet&lt;/code&gt; 中）或其他顺序。一组元素的顺序也可能是不确定的。在这些情况下，元素仍然以某种方式有序，因此依赖元素位置的函数依然会返回结果。不过，除非调用者知道所用 &lt;code&gt;Set&lt;/code&gt; 的具体实现，否则这些结果是不可预测的。&lt;/p&gt;</description></item></channel></rss>