Skip to content

Convert SparseIntArraySet.size to a val.#380

Merged
colinrtwhite merged 2 commits into
masterfrom
colin/collections
Apr 30, 2020
Merged

Convert SparseIntArraySet.size to a val.#380
colinrtwhite merged 2 commits into
masterfrom
colin/collections

Conversation

@colinrtwhite
Copy link
Copy Markdown
Member

@colinrtwhite colinrtwhite commented Apr 30, 2020

This is more in line with Kotlin's collections.

@colinrtwhite colinrtwhite requested a review from Jawnnypoo April 30, 2020 09:09
}

/** Return an iterator over the set's values. */
operator fun SparseIntArraySet.iterator(): IntIterator = object : IntIterator() {
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

2 participants