How can I get all locations in a list that are not equal to a value(without using a for loop)?
<p>okay not sure if there is a better way than I'm already doing.  Right now I have a list(int[]) that has a over 10,000 values that equal 0 in it and I'm looking for only the non-zero items.</p>

<p>My current approach is just to do a for loop and capture all the non-zeros but I do this a lot, and profiling shows its taking a large amount of my cpu time(since I'm doing this so often).  Is there a way I can get the same results without the expensive cpu process(since out 10,000 items, only less than 100 will be non-zeros)?</p>

<p>Here's an example of my data:</p>

<pre><code>int[] list = {0,0,0,1,0,10 }
int[] list_names = {a,b,c,d,e,f}
</code></pre>

<p>All I need to ultimately do is use these two lists to create another two lists with only the non-zero values and their names(so D=1 and F=10). I've seen some solutions where I need to sort the results before it works but thats a problem because if I sort the data list then I cannot identify its name.</p>

<p>Is this possible and is there a faster way compared to a for loop?</p>

<p>Sorry I should mention that this large lists remain in my program for processing and I'm trying to do this to reduce the memory footprint of them.  I have a queue of a few hundred million of these lists being stored in their entirety when all I really need is the non-zero values, so doing this to save memory(which seems to be working) but I'm also trying not to take a bit hit on the cpu to get it to that point(since I need the cpu for my processing).</p>
