Minor improvements in collections.pyx
### Description
This PR introduces minor improvements to collections.pyx:
* Adds missed type annotations yielding slightly more optimised code
* Adds missed `cpdef` methods used internally
* Marks private methods with `@cython.final`
Fixes #9477
### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)
-->
This pull request is:
- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [X] A short code fix
- please include the issue number, and create an issue if none exists, which
must include a complete example of the issue. one line code fixes without an
issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests. one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.
**Have a nice day!**
Closes: #9478
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9478
Pull-request-sha:
c006c76c2c50491ea1be9c723c278da16c151397
Change-Id: I74b3df2bc790db49e331b8f8085c797249364b07