@@ -38,7 +38,6 @@ public data class Headers private constructor(
3838 * Returns the first header value for the given name, or null if none.
3939 *
4040 * @param name the header name (case-insensitive)
41- * @return the first header value, or null if not found
4241 */
4342 public fun get (name : String ): String? = headersMap[sanitizeName(name)]?.firstOrNull()
4443
@@ -71,24 +70,19 @@ public data class Headers private constructor(
7170 public fun contains (name : HttpHeaderName ): Boolean = headersMap.containsKey(name.caseInsensitiveName)
7271
7372 /* *
74- * Returns a point-in-time snapshot of all header names at the time of the call .
73+ * Returns a snapshot of all header names.
7574 *
76- * Returns a defensive copy (`Set<String>`) so that callers cannot observe later
77- * mutations to this [Headers] instance through the returned set. The set is exposed
78- * through Kotlin's read-only [Set] type.
79- *
80- * @return a snapshot of header names
75+ * A defensive copy (`Set<String>`) exposed through Kotlin's read-only [Set] type, so
76+ * callers cannot observe later mutations to this [Headers] instance through it.
8177 */
8278 public fun names (): Set <String > = headersMap.keys.toSet()
8379
8480 /* *
85- * Returns a point-in-time snapshot of all header entries at the time of the call .
81+ * Returns a snapshot of all header entries.
8682 *
8783 * Each entry is copied into a fresh map so that callers cannot observe later mutations
8884 * to this [Headers] instance through the returned set. The set and its per-name value
8985 * lists are exposed through Kotlin's read-only [Set] / [List] types.
90- *
91- * @return a snapshot of header entries as [Map.Entry]
9286 */
9387 public fun entries (): Set <Map .Entry <String , List <String >>> {
9488 val snapshot = LinkedHashMap <String , List <String >>(headersMap.size)
@@ -98,11 +92,7 @@ public data class Headers private constructor(
9892 return snapshot.entries
9993 }
10094
101- /* *
102- * Returns a new [Builder] initialized with the existing headers.
103- *
104- * @return a new [Builder]
105- */
95+ /* * Returns a new [Builder] initialized with the existing headers. */
10696 public fun newBuilder (): Builder = Builder (this )
10797
10898 override fun toString (): String = headersMap.toString()
@@ -120,8 +110,6 @@ public data class Headers private constructor(
120110
121111 /* *
122112 * Creates a new builder initialized with the headers from [headers].
123- *
124- * @param headers the headers to initialize from
125113 */
126114 public constructor (headers: Headers ) : this () {
127115 headers.headersMap.forEach { (key, values) ->
@@ -132,10 +120,6 @@ public data class Headers private constructor(
132120 /* *
133121 * Adds a header with the specified name and value.
134122 * Multiple headers with the same name are allowed.
135- *
136- * @param name the header name
137- * @param value the header value
138- * @return this builder
139123 */
140124 public fun add (
141125 name : String ,
@@ -144,10 +128,6 @@ public data class Headers private constructor(
144128
145129 /* *
146130 * Adds all header values for the specified name.
147- *
148- * @param name the header name
149- * @param values the list of header values
150- * @return this builder
151131 */
152132 public fun add (
153133 name : String ,
@@ -175,7 +155,6 @@ public data class Headers private constructor(
175155 *
176156 * @param name the header name
177157 * @param value the header value, which may contain non-ASCII bytes
178- * @return this builder
179158 * @throws IllegalArgumentException if [name] is blank or contains a control/non-ASCII byte,
180159 * or [value] contains a prohibited control character
181160 */
@@ -213,10 +192,6 @@ public data class Headers private constructor(
213192 * Sets the header with the specified name to the single value provided.
214193 * If headers with this name already exist, they are removed. Passing a `null`
215194 * [value] removes the header entirely (Azure / OkHttp semantics).
216- *
217- * @param name the header name
218- * @param value the header value, or `null` to remove
219- * @return this builder
220195 */
221196 public fun set (
222197 name : String ,
@@ -233,10 +208,6 @@ public data class Headers private constructor(
233208 /* *
234209 * Sets the header with the specified name to the values list provided.
235210 * If headers with this name already exist, they are removed.
236- *
237- * @param name the header name
238- * @param values the header values
239- * @return this builder
240211 */
241212 public fun set (
242213 name : String ,
@@ -278,9 +249,6 @@ public data class Headers private constructor(
278249
279250 /* *
280251 * Removes any header with the specified name.
281- *
282- * @param name the header name
283- * @return this builder
284252 */
285253 public fun remove (name : String ): Builder =
286254 apply {
@@ -309,11 +277,7 @@ public data class Headers private constructor(
309277 }
310278 }
311279
312- /* *
313- * Builds an immutable [Headers] instance.
314- *
315- * @return the built [Headers]
316- */
280+ /* * Builds an immutable [Headers] instance. */
317281 public fun build (): Headers {
318282 // Deep, defensive copy: snapshot each value list into its own fresh copy so
319283 // that later builder mutations cannot reach into the built instance. The
0 commit comments