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