Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert SparseIntArraySet.size to a val. #380

Merged
merged 2 commits into from Apr 30, 2020
Merged

Conversation

colinrtwhite
Copy link
Member

@colinrtwhite colinrtwhite commented Apr 30, 2020

This is more in line with Kotlin's collections.

action(elementAt(index))
}
}

/** Return an iterator over the set's values. */
operator fun SparseIntArraySet.iterator(): IntIterator = object : IntIterator() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this as SparseIntArray ktx has it.


/** Adds an element to the set. */
/** Returns the number of elements that this set currently stores. */
val size: Int @JvmName("size") get() = _size
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does JvmName just allow it to be a method for Java callers? Or is it needed otherwise?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jawnnypoo It sets the callable name in Java so Java callers call set.size() instead of set.getSize().

@colinrtwhite colinrtwhite merged commit 5e6a69b into master Apr 30, 2020
@colinrtwhite colinrtwhite deleted the colin/collections branch April 30, 2020 18:38
colinrtwhite added a commit that referenced this pull request Oct 5, 2022
* Convert SparseIntArraySet.size to a val.

* Update binary compatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants