Add take method to collection class

New pull request to the 4.0 branch. See #1919 for more info.