Improve the documentation of MatchGroupCollection.

#KT-7938 Fixed
This commit is contained in:
Ilya Gorbunov
2015-06-04 20:47:15 +03:00
parent 98407a7c4b
commit 1036448fcd
@@ -16,15 +16,24 @@
package kotlin.text package kotlin.text
/** Represents a collection of captured groups in a single match. */ /**
* Represents a collection of captured groups in a single match of a regular expression.
*
* Groups are indexed from 1 to the count of groups in the regular expression.
* The first group (with the index 0) corresponds to the entire match.
*
* An element of the collection at the particular index can be `null`,
* if the corresponding group in the regular expression is optional and
* there was not match captured by that group.
*/
public interface MatchGroupCollection : Collection<MatchGroup?> { public interface MatchGroupCollection : Collection<MatchGroup?> {
/** Returns a group with the specified [index]. /** Returns a group with the specified [index].
* *
* @return An instance of [MatchGroup] if the group with the specified [index] was matched or `null` otherwise. * @return An instance of [MatchGroup] if the group with the specified [index] was matched or `null` otherwise.
* *
* The groups are indexed from 1 to the count of groups in regular expression. The group with zero index * Groups are indexed from 1 to the count of groups in the regular expression. A group with the index 0
* represents the entire match. * corresponds to the entire match.
*/ */
public fun get(index: Int): MatchGroup? public fun get(index: Int): MatchGroup?