# Is there an efficient and elegant way to keep the top 2 values from an iterator

**URL:** https://discourse.julialang.org/t/is-there-an-efficient-and-elegant-way-to-keep-the-top-2-values-from-an-iterator/77121
**Category:** General Usage
**Created:** [February 26, 2022, 1:34pm UTC](https://discourse.julialang.org/t/is-there-an-efficient-and-elegant-way-to-keep-the-top-2-values-from-an-iterator/77121 "2022-02-26T13:34:24Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![rocco\_sprmnt21](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rocco_sprmnt21/32/20127_2.png) [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)
#### Post date: [February 26, 2022, 2:16pm UTC](https://discourse.julialang.org/t/is-there-an-efficient-and-elegant-way-to-keep-the-top-2-values-from-an-iterator/77121/2 "2022-02-26T14:16:05Z")

</div>

[here](https://discourse.julialang.org/t/the-quasi-best-maxn-function/52813/13) some related proposals.

---

_[View the full topic](https://discourse.julialang.org/t/is-there-an-efficient-and-elegant-way-to-keep-the-top-2-values-from-an-iterator/77121)._
