how to model this datamodel without to much space?
<p>I'm writing this question because I dont know how to model this dataModel which I need right.</p>

<p>First of all, this is what I have (<strong>I simplyfied it a bit</strong>):
I have a <code>List&lt;Foo&gt; list;</code> where Foo has three attributes:</p>

<pre><code>public class Foo {
    public int one;
    public int two;
    public long three;
}
</code></pre>

<p>now I have a other <code>List&lt;int&gt; list2;</code></p>

<p>the most important thing: the first item in <code>list</code> and the first in <code>list2</code> are corresponding.</p>

<p><strong>What I want to get:</strong>
I want to have a structure, wher I can enter the one,two,three and then get the corresponding <code>int</code></p>

<p>I tired this:
I found out the max values of one, two and three and then created a <code>int[maxOne][maxTwo][maxThree]</code> and filled it in a loop:</p>

<pre><code>int count = 0;
int[][][] daten = new int[maxOne][maxTwo][maxThree];
for (Foo foo : list)
{
    daten[foo.one][foo.two][foo.three] = list2[count];
    count++;
}
</code></pre>

<p>but this is a bad idea because the <code>new int[maxOne][maxTwo][maxThree];</code> need very much memory and not every value in this 3 dimensinal array is needed.</p>

<p>So what is your recommondation?</p>
