Can I access CoreData objects by index?
<p>I'm using CoreData as a persistent store for my app data but would like to access elements in my data model by index rather than iterating through the whole collection every time.</p>

<p>For example if I have data of the form:</p>

<ol>
<li>"George"</li>
<li>"Bill" </li>
<li>"George" </li>
<li>"Barack"</li>
<li>"Donald"</li>
</ol>

<p>I'd like to be able to update the elements without searching the collection each time.</p>

<p>If the data was in an array this would be easy ie: </p>

<pre><code>Presidents[5] = "Hilary"
</code></pre>

<p>There doesn't seem to be an easy way to do this in CoreData other than</p>

<pre><code>for president in Presidents{
    if(president.id == 5){
        president.name = "Hilary"
     }
}
</code></pre>

<p>Which for large data sets will get hugely expensive. Am I missing something?</p>