Docs: proper pluralization of 'entry'
This commit is contained in:
@@ -88,7 +88,7 @@ public inline fun <K, V, R, C : MutableCollection<in R>> Map<K, V>.mapTo(destina
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns `true` if all entrys match the given [predicate].
|
* Returns `true` if all entries match the given [predicate].
|
||||||
*/
|
*/
|
||||||
public inline fun <K, V> Map<K, V>.all(predicate: (Map.Entry<K, V>) -> Boolean): Boolean {
|
public inline fun <K, V> Map<K, V>.all(predicate: (Map.Entry<K, V>) -> Boolean): Boolean {
|
||||||
for (element in this) if (!predicate(element)) return false
|
for (element in this) if (!predicate(element)) return false
|
||||||
@@ -112,14 +112,14 @@ public inline fun <K, V> Map<K, V>.any(predicate: (Map.Entry<K, V>) -> Boolean):
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of entrys in this map.
|
* Returns the number of entries in this map.
|
||||||
*/
|
*/
|
||||||
public fun <K, V> Map<K, V>.count(): Int {
|
public fun <K, V> Map<K, V>.count(): Int {
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of entrys matching the given [predicate].
|
* Returns the number of entries matching the given [predicate].
|
||||||
*/
|
*/
|
||||||
public inline fun <K, V> Map<K, V>.count(predicate: (Map.Entry<K, V>) -> Boolean): Int {
|
public inline fun <K, V> Map<K, V>.count(predicate: (Map.Entry<K, V>) -> Boolean): Int {
|
||||||
var count = 0
|
var count = 0
|
||||||
@@ -173,7 +173,7 @@ public inline fun <K, V, R : Comparable<R>> Map<K, V>.minBy(selector: (Map.Entry
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns `true` if the map has no entrys.
|
* Returns `true` if the map has no entries.
|
||||||
*/
|
*/
|
||||||
public fun <K, V> Map<K, V>.none(): Boolean {
|
public fun <K, V> Map<K, V>.none(): Boolean {
|
||||||
for (element in this) return false
|
for (element in this) return false
|
||||||
@@ -181,7 +181,7 @@ public fun <K, V> Map<K, V>.none(): Boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns `true` if no entrys match the given [predicate].
|
* Returns `true` if no entries match the given [predicate].
|
||||||
*/
|
*/
|
||||||
public inline fun <K, V> Map<K, V>.none(predicate: (Map.Entry<K, V>) -> Boolean): Boolean {
|
public inline fun <K, V> Map<K, V>.none(predicate: (Map.Entry<K, V>) -> Boolean): Boolean {
|
||||||
for (element in this) if (predicate(element)) return false
|
for (element in this) if (predicate(element)) return false
|
||||||
@@ -189,14 +189,14 @@ public inline fun <K, V> Map<K, V>.none(predicate: (Map.Entry<K, V>) -> Boolean)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an [Iterable] instance that wraps the original map returning its entrys when being iterated.
|
* Creates an [Iterable] instance that wraps the original map returning its entries when being iterated.
|
||||||
*/
|
*/
|
||||||
public fun <K, V> Map<K, V>.asIterable(): Iterable<Map.Entry<K, V>> {
|
public fun <K, V> Map<K, V>.asIterable(): Iterable<Map.Entry<K, V>> {
|
||||||
return entries
|
return entries
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a [Sequence] instance that wraps the original map returning its entrys when being iterated.
|
* Creates a [Sequence] instance that wraps the original map returning its entries when being iterated.
|
||||||
*/
|
*/
|
||||||
public fun <K, V> Map<K, V>.asSequence(): Sequence<Map.Entry<K, V>> {
|
public fun <K, V> Map<K, V>.asSequence(): Sequence<Map.Entry<K, V>> {
|
||||||
return object : Sequence<Map.Entry<K, V>> {
|
return object : Sequence<Map.Entry<K, V>> {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ fun aggregates(): List<GenericFunction> {
|
|||||||
|
|
||||||
templates add f("all(predicate: (T) -> Boolean)") {
|
templates add f("all(predicate: (T) -> Boolean)") {
|
||||||
inline(true)
|
inline(true)
|
||||||
doc { f -> "Returns `true` if all ${f.element}s match the given [predicate]." }
|
doc { f -> "Returns `true` if all ${f.element.pluralize()} match the given [predicate]." }
|
||||||
returns("Boolean")
|
returns("Boolean")
|
||||||
body {
|
body {
|
||||||
"""
|
"""
|
||||||
@@ -22,7 +22,7 @@ fun aggregates(): List<GenericFunction> {
|
|||||||
templates add f("none(predicate: (T) -> Boolean)") {
|
templates add f("none(predicate: (T) -> Boolean)") {
|
||||||
inline(true)
|
inline(true)
|
||||||
|
|
||||||
doc { f -> "Returns `true` if no ${f.element}s match the given [predicate]." }
|
doc { f -> "Returns `true` if no ${f.element.pluralize()} match the given [predicate]." }
|
||||||
returns("Boolean")
|
returns("Boolean")
|
||||||
body {
|
body {
|
||||||
"""
|
"""
|
||||||
@@ -35,7 +35,7 @@ fun aggregates(): List<GenericFunction> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templates add f("none()") {
|
templates add f("none()") {
|
||||||
doc { f -> "Returns `true` if the ${f.collection} has no ${f.element}s." }
|
doc { f -> "Returns `true` if the ${f.collection} has no ${f.element.pluralize()}." }
|
||||||
returns("Boolean")
|
returns("Boolean")
|
||||||
body {
|
body {
|
||||||
"""
|
"""
|
||||||
@@ -78,7 +78,7 @@ fun aggregates(): List<GenericFunction> {
|
|||||||
templates add f("count(predicate: (T) -> Boolean)") {
|
templates add f("count(predicate: (T) -> Boolean)") {
|
||||||
inline(true)
|
inline(true)
|
||||||
|
|
||||||
doc { f -> "Returns the number of ${f.element}s matching the given [predicate]." }
|
doc { f -> "Returns the number of ${f.element.pluralize()} matching the given [predicate]." }
|
||||||
returns("Int")
|
returns("Int")
|
||||||
body {
|
body {
|
||||||
"""
|
"""
|
||||||
@@ -92,7 +92,7 @@ fun aggregates(): List<GenericFunction> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templates add f("count()") {
|
templates add f("count()") {
|
||||||
doc { f -> "Returns the number of ${f.element}s in this ${f.collection}." }
|
doc { f -> "Returns the number of ${f.element.pluralize()} in this ${f.collection}." }
|
||||||
returns("Int")
|
returns("Int")
|
||||||
body {
|
body {
|
||||||
"""
|
"""
|
||||||
@@ -146,7 +146,7 @@ fun aggregates(): List<GenericFunction> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templates add f("min()") {
|
templates add f("min()") {
|
||||||
doc { f -> "Returns the smallest ${f.element} or `null` if there are no ${f.element}s." }
|
doc { f -> "Returns the smallest ${f.element} or `null` if there are no ${f.element.pluralize()}." }
|
||||||
returns("T?")
|
returns("T?")
|
||||||
exclude(PrimitiveType.Boolean)
|
exclude(PrimitiveType.Boolean)
|
||||||
typeParam("T : Comparable<T>")
|
typeParam("T : Comparable<T>")
|
||||||
@@ -180,7 +180,7 @@ fun aggregates(): List<GenericFunction> {
|
|||||||
templates add f("minBy(selector: (T) -> R)") {
|
templates add f("minBy(selector: (T) -> R)") {
|
||||||
inline(true)
|
inline(true)
|
||||||
|
|
||||||
doc { f -> "Returns the first ${f.element} yielding the smallest value of the given function or `null` if there are no ${f.element}s." }
|
doc { f -> "Returns the first ${f.element} yielding the smallest value of the given function or `null` if there are no ${f.element.pluralize()}." }
|
||||||
typeParam("R : Comparable<R>")
|
typeParam("R : Comparable<R>")
|
||||||
typeParam("T : Any")
|
typeParam("T : Any")
|
||||||
returns("T?")
|
returns("T?")
|
||||||
@@ -250,7 +250,7 @@ fun aggregates(): List<GenericFunction> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templates add f("max()") {
|
templates add f("max()") {
|
||||||
doc { f -> "Returns the largest ${f.element} or `null` if there are no ${f.element}s." }
|
doc { f -> "Returns the largest ${f.element} or `null` if there are no ${f.element.pluralize()}." }
|
||||||
returns("T?")
|
returns("T?")
|
||||||
exclude(PrimitiveType.Boolean)
|
exclude(PrimitiveType.Boolean)
|
||||||
typeParam("T : Comparable<T>")
|
typeParam("T : Comparable<T>")
|
||||||
@@ -286,7 +286,7 @@ fun aggregates(): List<GenericFunction> {
|
|||||||
templates add f("maxBy(selector: (T) -> R)") {
|
templates add f("maxBy(selector: (T) -> R)") {
|
||||||
inline(true)
|
inline(true)
|
||||||
|
|
||||||
doc { f -> "Returns the first ${f.element} yielding the largest value of the given function or `null` if there are no ${f.element}s." }
|
doc { f -> "Returns the first ${f.element} yielding the largest value of the given function or `null` if there are no ${f.element.pluralize()}." }
|
||||||
typeParam("R : Comparable<R>")
|
typeParam("R : Comparable<R>")
|
||||||
typeParam("T : Any")
|
typeParam("T : Any")
|
||||||
returns("T?")
|
returns("T?")
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ fun filtering(): List<GenericFunction> {
|
|||||||
templates add f("filter(predicate: (T) -> Boolean)") {
|
templates add f("filter(predicate: (T) -> Boolean)") {
|
||||||
inline(true)
|
inline(true)
|
||||||
|
|
||||||
doc { f -> "Returns a ${f.mapResult} containing only ${f.element}s matching the given [predicate]." }
|
doc { f -> "Returns a ${f.mapResult} containing only ${f.element.pluralize()} matching the given [predicate]." }
|
||||||
returns("List<T>")
|
returns("List<T>")
|
||||||
body {
|
body {
|
||||||
"""
|
"""
|
||||||
@@ -373,7 +373,7 @@ fun filtering(): List<GenericFunction> {
|
|||||||
templates add f("filterTo(destination: C, predicate: (T) -> Boolean)") {
|
templates add f("filterTo(destination: C, predicate: (T) -> Boolean)") {
|
||||||
inline(true)
|
inline(true)
|
||||||
|
|
||||||
doc { f -> "Appends all ${f.element}s matching the given [predicate] to the given [destination]." }
|
doc { f -> "Appends all ${f.element.pluralize()} matching the given [predicate] to the given [destination]." }
|
||||||
typeParam("C : TCollection")
|
typeParam("C : TCollection")
|
||||||
returns("C")
|
returns("C")
|
||||||
|
|
||||||
@@ -399,7 +399,7 @@ fun filtering(): List<GenericFunction> {
|
|||||||
templates add f("filterIndexed(predicate: (Int, T) -> Boolean)") {
|
templates add f("filterIndexed(predicate: (Int, T) -> Boolean)") {
|
||||||
inline(true)
|
inline(true)
|
||||||
|
|
||||||
doc { f -> "Returns a ${f.mapResult} containing only ${f.element}s matching the given [predicate]." }
|
doc { f -> "Returns a ${f.mapResult} containing only ${f.element.pluralize()} matching the given [predicate]." }
|
||||||
returns("List<T>")
|
returns("List<T>")
|
||||||
body {
|
body {
|
||||||
"""
|
"""
|
||||||
@@ -427,7 +427,7 @@ fun filtering(): List<GenericFunction> {
|
|||||||
|
|
||||||
include(CharSequences)
|
include(CharSequences)
|
||||||
|
|
||||||
doc { f -> "Appends all ${f.element}s matching the given [predicate] to the given [destination]." }
|
doc { f -> "Appends all ${f.element.pluralize()} matching the given [predicate] to the given [destination]." }
|
||||||
typeParam("C : TCollection")
|
typeParam("C : TCollection")
|
||||||
returns("C")
|
returns("C")
|
||||||
|
|
||||||
@@ -542,7 +542,7 @@ fun filtering(): List<GenericFunction> {
|
|||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
doc(CharSequences, Strings) { f -> "Returns a ${f.collection} containing ${f.element}s of the original ${f.collection} at specified [indices]." }
|
doc(CharSequences, Strings) { f -> "Returns a ${f.collection} containing ${f.element.pluralize()} of the original ${f.collection} at specified [indices]." }
|
||||||
returns(CharSequences, Strings) { "SELF" }
|
returns(CharSequences, Strings) { "SELF" }
|
||||||
body(CharSequences, Strings) { f ->
|
body(CharSequences, Strings) { f ->
|
||||||
"""
|
"""
|
||||||
@@ -574,7 +574,7 @@ fun filtering(): List<GenericFunction> {
|
|||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
doc(CharSequences, Strings) { f -> "Returns a ${f.collection} containing ${f.element}s of the original ${f.collection} at the specified range of [indices]." }
|
doc(CharSequences, Strings) { f -> "Returns a ${f.collection} containing ${f.element.pluralize()} of the original ${f.collection} at the specified range of [indices]." }
|
||||||
returns(CharSequences, Strings) { "SELF" }
|
returns(CharSequences, Strings) { "SELF" }
|
||||||
body(CharSequences, Strings) { f ->
|
body(CharSequences, Strings) { f ->
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ fun mapping(): List<GenericFunction> {
|
|||||||
|
|
||||||
deprecate(Strings) { forBinaryCompatibility }
|
deprecate(Strings) { forBinaryCompatibility }
|
||||||
include(CharSequences, Strings)
|
include(CharSequences, Strings)
|
||||||
doc { f -> "Returns a map of the ${f.element}s in original ${f.collection} grouped by the key returned by the given [selector] function." }
|
doc { f -> "Returns a map of the ${f.element.pluralize()} in original ${f.collection} grouped by the key returned by the given [selector] function." }
|
||||||
typeParam("K")
|
typeParam("K")
|
||||||
returns("Map<K, List<T>>")
|
returns("Map<K, List<T>>")
|
||||||
body { "return groupByTo(LinkedHashMap<K, MutableList<T>>(), selector)" }
|
body { "return groupByTo(LinkedHashMap<K, MutableList<T>>(), selector)" }
|
||||||
@@ -301,7 +301,7 @@ fun mapping(): List<GenericFunction> {
|
|||||||
deprecate(Strings) { forBinaryCompatibility }
|
deprecate(Strings) { forBinaryCompatibility }
|
||||||
include(CharSequences, Strings)
|
include(CharSequences, Strings)
|
||||||
typeParam("K")
|
typeParam("K")
|
||||||
doc { f -> "Appends ${f.element}s from original ${f.collection} grouped by the key returned by the given [selector] function to the given [map]." }
|
doc { f -> "Appends ${f.element.pluralize()} from original ${f.collection} grouped by the key returned by the given [selector] function to the given [map]." }
|
||||||
returns("Map<K, MutableList<T>>")
|
returns("Map<K, MutableList<T>>")
|
||||||
body {
|
body {
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ fun ordering(): List<GenericFunction> {
|
|||||||
val templates = arrayListOf<GenericFunction>()
|
val templates = arrayListOf<GenericFunction>()
|
||||||
|
|
||||||
templates add f("reverse()") {
|
templates add f("reverse()") {
|
||||||
doc { f -> "Reverses ${f.element}s in the ${f.collection} in-place." }
|
doc { f -> "Reverses ${f.element.pluralize()} in the ${f.collection} in-place." }
|
||||||
only(Lists, ArraysOfObjects, ArraysOfPrimitives)
|
only(Lists, ArraysOfObjects, ArraysOfPrimitives)
|
||||||
customReceiver(Lists) { "MutableList<T>" }
|
customReceiver(Lists) { "MutableList<T>" }
|
||||||
returns { "Unit" }
|
returns { "Unit" }
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ fun sequences(): List<GenericFunction> {
|
|||||||
|
|
||||||
templates add f("asIterable()") {
|
templates add f("asIterable()") {
|
||||||
only(Iterables, ArraysOfObjects, ArraysOfPrimitives, Sequences, CharSequences, Maps)
|
only(Iterables, ArraysOfObjects, ArraysOfPrimitives, Sequences, CharSequences, Maps)
|
||||||
doc { f -> "Creates an [Iterable] instance that wraps the original ${f.collection} returning its ${f.element}s when being iterated." }
|
doc { f -> "Creates an [Iterable] instance that wraps the original ${f.collection} returning its ${f.element.pluralize()} when being iterated." }
|
||||||
returns("Iterable<T>")
|
returns("Iterable<T>")
|
||||||
body { f ->
|
body { f ->
|
||||||
"""
|
"""
|
||||||
@@ -28,7 +28,7 @@ fun sequences(): List<GenericFunction> {
|
|||||||
|
|
||||||
templates add f("asSequence()") {
|
templates add f("asSequence()") {
|
||||||
include(Maps)
|
include(Maps)
|
||||||
doc { f -> "Creates a [Sequence] instance that wraps the original ${f.collection} returning its ${f.element}s when being iterated." }
|
doc { f -> "Creates a [Sequence] instance that wraps the original ${f.collection} returning its ${f.element.pluralize()} when being iterated." }
|
||||||
returns("Sequence<T>")
|
returns("Sequence<T>")
|
||||||
body { f ->
|
body { f ->
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ fun sets(): List<GenericFunction> {
|
|||||||
|
|
||||||
templates add f("toMutableSet()") {
|
templates add f("toMutableSet()") {
|
||||||
exclude(Strings)
|
exclude(Strings)
|
||||||
doc { f -> "Returns a mutable set containing all distinct ${f.element}s from the given ${f.collection}." }
|
doc { f -> "Returns a mutable set containing all distinct ${f.element.pluralize()} from the given ${f.collection}." }
|
||||||
returns("MutableSet<T>")
|
returns("MutableSet<T>")
|
||||||
body {
|
body {
|
||||||
"""
|
"""
|
||||||
@@ -38,9 +38,9 @@ fun sets(): List<GenericFunction> {
|
|||||||
exclude(Strings)
|
exclude(Strings)
|
||||||
doc { f ->
|
doc { f ->
|
||||||
"""
|
"""
|
||||||
Returns a ${f.mapResult} containing only distinct ${f.element}s from the given ${f.collection}.
|
Returns a ${f.mapResult} containing only distinct ${f.element.pluralize()} from the given ${f.collection}.
|
||||||
|
|
||||||
The ${f.element}s in the resulting ${f.mapResult} are in the same order as they were in the source ${f.collection}.
|
The ${f.element.pluralize()} in the resulting ${f.mapResult} are in the same order as they were in the source ${f.collection}.
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,10 +54,10 @@ fun sets(): List<GenericFunction> {
|
|||||||
exclude(Strings)
|
exclude(Strings)
|
||||||
doc { f ->
|
doc { f ->
|
||||||
"""
|
"""
|
||||||
Returns a ${f.mapResult} containing only ${f.element}s from the given ${f.collection}
|
Returns a ${f.mapResult} containing only ${f.element.pluralize()} from the given ${f.collection}
|
||||||
having distinct keys returned by the given [selector] function.
|
having distinct keys returned by the given [selector] function.
|
||||||
|
|
||||||
The ${f.element}s in the resulting ${f.mapResult} are in the same order as they were in the source ${f.collection}.
|
The ${f.element.pluralize()} in the resulting ${f.mapResult} are in the same order as they were in the source ${f.collection}.
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ fun snapshots(): List<GenericFunction> {
|
|||||||
templates add f("toCollection(destination: C)") {
|
templates add f("toCollection(destination: C)") {
|
||||||
deprecate(Strings) { forBinaryCompatibility }
|
deprecate(Strings) { forBinaryCompatibility }
|
||||||
include(CharSequences, Strings)
|
include(CharSequences, Strings)
|
||||||
doc { f -> "Appends all ${f.element}s to the given [destination] collection." }
|
doc { f -> "Appends all ${f.element.pluralize()} to the given [destination] collection." }
|
||||||
returns("C")
|
returns("C")
|
||||||
typeParam("C : MutableCollection<in T>")
|
typeParam("C : MutableCollection<in T>")
|
||||||
body {
|
body {
|
||||||
@@ -22,7 +22,7 @@ fun snapshots(): List<GenericFunction> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templates add f("toSet()") {
|
templates add f("toSet()") {
|
||||||
doc { f -> "Returns a [Set] of all ${f.element}s." }
|
doc { f -> "Returns a [Set] of all ${f.element.pluralize()}." }
|
||||||
returns("Set<T>")
|
returns("Set<T>")
|
||||||
body { "return toCollection(LinkedHashSet<T>(mapCapacity(collectionSizeOrDefault(12))))" }
|
body { "return toCollection(LinkedHashSet<T>(mapCapacity(collectionSizeOrDefault(12))))" }
|
||||||
body(Sequences) { "return toCollection(LinkedHashSet<T>())" }
|
body(Sequences) { "return toCollection(LinkedHashSet<T>())" }
|
||||||
@@ -32,7 +32,7 @@ fun snapshots(): List<GenericFunction> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templates add f("toHashSet()") {
|
templates add f("toHashSet()") {
|
||||||
doc { f -> "Returns a [HashSet] of all ${f.element}s." }
|
doc { f -> "Returns a [HashSet] of all ${f.element.pluralize()}." }
|
||||||
returns("HashSet<T>")
|
returns("HashSet<T>")
|
||||||
body { "return toCollection(HashSet<T>(mapCapacity(collectionSizeOrDefault(12))))" }
|
body { "return toCollection(HashSet<T>(mapCapacity(collectionSizeOrDefault(12))))" }
|
||||||
body(Sequences) { "return toCollection(HashSet<T>())" }
|
body(Sequences) { "return toCollection(HashSet<T>())" }
|
||||||
@@ -45,7 +45,7 @@ fun snapshots(): List<GenericFunction> {
|
|||||||
deprecate(Strings) { forBinaryCompatibility }
|
deprecate(Strings) { forBinaryCompatibility }
|
||||||
include(CharSequences, Strings)
|
include(CharSequences, Strings)
|
||||||
typeParam("T: Comparable<T>")
|
typeParam("T: Comparable<T>")
|
||||||
doc { f -> "Returns a [SortedSet] of all ${f.element}s." }
|
doc { f -> "Returns a [SortedSet] of all ${f.element.pluralize()}." }
|
||||||
returns("SortedSet<T>")
|
returns("SortedSet<T>")
|
||||||
body { "return toCollection(TreeSet<T>())" }
|
body { "return toCollection(TreeSet<T>())" }
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,7 @@ fun snapshots(): List<GenericFunction> {
|
|||||||
jvmOnly(true)
|
jvmOnly(true)
|
||||||
doc { f ->
|
doc { f ->
|
||||||
"""
|
"""
|
||||||
Returns a [SortedSet] of all ${f.element}s.
|
Returns a [SortedSet] of all ${f.element.pluralize()}.
|
||||||
|
|
||||||
Elements in the set returned are sorted according to the given [comparator].
|
Elements in the set returned are sorted according to the given [comparator].
|
||||||
"""
|
"""
|
||||||
@@ -65,7 +65,7 @@ fun snapshots(): List<GenericFunction> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templates add f("toArrayList()") {
|
templates add f("toArrayList()") {
|
||||||
doc { f -> "Returns an [ArrayList] of all ${f.element}s." }
|
doc { f -> "Returns an [ArrayList] of all ${f.element.pluralize()}." }
|
||||||
returns("ArrayList<T>")
|
returns("ArrayList<T>")
|
||||||
body { "return toCollection(ArrayList<T>())" }
|
body { "return toCollection(ArrayList<T>())" }
|
||||||
body(Iterables) {
|
body(Iterables) {
|
||||||
@@ -105,7 +105,7 @@ fun snapshots(): List<GenericFunction> {
|
|||||||
templates add f("toList()") {
|
templates add f("toList()") {
|
||||||
deprecate(Strings) { forBinaryCompatibility }
|
deprecate(Strings) { forBinaryCompatibility }
|
||||||
include(CharSequences, Strings)
|
include(CharSequences, Strings)
|
||||||
doc { f -> "Returns a [List] containing all ${f.element}s." }
|
doc { f -> "Returns a [List] containing all ${f.element.pluralize()}." }
|
||||||
returns("List<T>")
|
returns("List<T>")
|
||||||
body { "return this.toArrayList()" }
|
body { "return this.toArrayList()" }
|
||||||
}
|
}
|
||||||
@@ -132,9 +132,9 @@ fun snapshots(): List<GenericFunction> {
|
|||||||
typeParam("K")
|
typeParam("K")
|
||||||
doc { f ->
|
doc { f ->
|
||||||
"""
|
"""
|
||||||
Returns Map containing the ${f.element}s from the given ${f.collection} indexed by the key
|
Returns Map containing the ${f.element.pluralize()} from the given ${f.collection} indexed by the key
|
||||||
returned from [selector] function applied to each ${f.element}.
|
returned from [selector] function applied to each ${f.element}.
|
||||||
If any two ${f.element}s would have the same key returned by [selector] the last one gets added to the map.
|
If any two ${f.element.pluralize()} would have the same key returned by [selector] the last one gets added to the map.
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
returns("Map<K, T>")
|
returns("Map<K, T>")
|
||||||
@@ -192,8 +192,8 @@ fun snapshots(): List<GenericFunction> {
|
|||||||
typeParam("V")
|
typeParam("V")
|
||||||
doc { f ->
|
doc { f ->
|
||||||
"""
|
"""
|
||||||
Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to ${f.element}s of the given ${f.collection}.
|
Returns Map containing the values provided by [transform] and indexed by [selector] functions applied to ${f.element.pluralize()} of the given ${f.collection}.
|
||||||
If any two ${f.element}s would have the same key returned by [selector] the last one gets added to the map.
|
If any two ${f.element.pluralize()} would have the same key returned by [selector] the last one gets added to the map.
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
returns("Map<K, V>")
|
returns("Map<K, V>")
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ object DocExtensions {
|
|||||||
|
|
||||||
private fun String.singularize() = removeSuffix("s")
|
private fun String.singularize() = removeSuffix("s")
|
||||||
|
|
||||||
|
public fun String.pluralize() = when {
|
||||||
|
this.endsWith("y") -> this.dropLast(1) + "ies"
|
||||||
|
else -> this + "s"
|
||||||
|
}
|
||||||
|
|
||||||
fun String.prefixWithArticle() = (if ("aeiou".any { this.startsWith(it, ignoreCase = true) }) "an " else "a ").concat(this)
|
fun String.prefixWithArticle() = (if ("aeiou".any { this.startsWith(it, ignoreCase = true) }) "an " else "a ").concat(this)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user