xref: /aosp_15_r20/external/bazel-skylib/docs/collections_doc.md (revision bcb5dc7965af6ee42bf2f21341a2ec00233a8c8a)
1<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2
3Skylib module containing functions that operate on collections.
4
5<a id="collections.after_each"></a>
6
7## collections.after_each
8
9<pre>
10collections.after_each(<a href="#collections.after_each-separator">separator</a>, <a href="#collections.after_each-iterable">iterable</a>)
11</pre>
12
13Inserts `separator` after each item in `iterable`.
14
15**PARAMETERS**
16
17
18| Name  | Description | Default Value |
19| :------------- | :------------- | :------------- |
20| <a id="collections.after_each-separator"></a>separator |  The value to insert after each item in `iterable`.   |  none |
21| <a id="collections.after_each-iterable"></a>iterable |  The list into which to intersperse the separator.   |  none |
22
23**RETURNS**
24
25A new list with `separator` after each item in `iterable`.
26
27
28<a id="collections.before_each"></a>
29
30## collections.before_each
31
32<pre>
33collections.before_each(<a href="#collections.before_each-separator">separator</a>, <a href="#collections.before_each-iterable">iterable</a>)
34</pre>
35
36Inserts `separator` before each item in `iterable`.
37
38**PARAMETERS**
39
40
41| Name  | Description | Default Value |
42| :------------- | :------------- | :------------- |
43| <a id="collections.before_each-separator"></a>separator |  The value to insert before each item in `iterable`.   |  none |
44| <a id="collections.before_each-iterable"></a>iterable |  The list into which to intersperse the separator.   |  none |
45
46**RETURNS**
47
48A new list with `separator` before each item in `iterable`.
49
50
51<a id="collections.uniq"></a>
52
53## collections.uniq
54
55<pre>
56collections.uniq(<a href="#collections.uniq-iterable">iterable</a>)
57</pre>
58
59Returns a list of unique elements in `iterable`.
60
61Requires all the elements to be hashable.
62
63
64**PARAMETERS**
65
66
67| Name  | Description | Default Value |
68| :------------- | :------------- | :------------- |
69| <a id="collections.uniq-iterable"></a>iterable |  An iterable to filter.   |  none |
70
71**RETURNS**
72
73A new list with all unique elements from `iterable`.
74
75
76