# Alternative to Array#index?

**URL:** <https://www.ruby-forum.com/t/alternative-to-array-index/107765>\
**Category:** Ruby\
**Created:** [June 26, 2007, 1:06am UTC](https://www.ruby-forum.com/t/alternative-to-array-index/107765 "2007-06-26T01:06:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ktheory](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Post date:** [June 26, 2007, 1:06am UTC](https://www.ruby-forum.com/t/alternative-to-array-index/107765/1 "2007-06-26T01:06:00Z")

</div>

is there an alternative to Array#index? Faster version maybe?

---

<div class="post-metadata">

**Author:** ![ktheory](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Post date:** [June 26, 2007, 9:17am UTC](https://www.ruby-forum.com/t/alternative-to-array-index/107765/2 "2007-06-26T09:17:47Z")

</div>

Aaron S. wrote:

> is there an alternative to Array#index? Faster version maybe?

Change the problem so that you’re reading from a hash? Maintain an  
index hash alongside the array? Keep the array sorted somehow? It  
depends on the problem you’re trying to solve, really…
