title: Deciding what method to call at runtime without using interfaces for context (no Java8 features)
body: <p>The title can easily be misunderstood, but it boils down to that I most likely require a <a href="/questions/tagged/design-pattern" class="post-tag" title="show questions tagged &#39;design-pattern&#39;" rel="tag">design-pattern</a> to eliminate redundant code. To make my question as clear as possible I made a code example instead of writing a vague explanation.</p>
  
  <hr>
  
  <p>Basically, I have the following functions:<br />
  <em><code>getValue1()</code>, <code>getValue2()</code>, <code>getValue3()</code>, <code>...</code> , <code>getValue12()</code></em></p>
  
  <p>These functions could look as follows <em>(though all differ slightly from each other and are not editable by means of making them implement an interface for a strategy pattern)</em>:</p>
  
  <pre><code>public int getValue1()
  {
      return 1 + 2;
  }
  </code></pre>
  
  <p><br />
  Next we have a secondary class <code>myClass</code> which requires the values returned by the <em>getValue()</em> functions. A function from <code>myClass</code> would then look as follows <em>(each differ in the fact that they make use of a different getValue() function)</em>:</p>
  
  <pre><code>public int getMyValues1()
  {
      int[] values = new int[10];
      for (int i = 0; i &lt; 10; i++) {
          int[i] = getValue1() // NOTE: getValueX() may output differently each time.
      }
  }
  </code></pre>
  
  <p><br />
  We have arrived at our problem.<br />
  If we would make a <em>getMyValues()</em> function for each respective <em>getValue()</em>, we would have to copy and then paste the same code several times.<br /><br />
  This goes against everything OOP languages stand for - that's why I require your help.
  <br /><br /><br />
  Any suggestion is much appreciated!
  <br /><br /></p>
  
  <hr>
  
  <p><br/><strong>EDIT:</strong><br /><br />
  I reopened the question, because I didn't have Java 8 supported on the IDE I am to use.</p>
  
  <p>Basically I have the following setup:</p>
  
  <pre><code>getValueClass
      getValue1()
      getValue2()
      etc.
  
  myClass
      getMyValues1()
      getMyValues2()
      etc.
  
  implemetingClass
      private myClass mc = new MyClass()
      main()
      getLowestValue(int[] values)
  </code></pre>
  
  <p><br />
  And so <em>main()</em> could look as follows - if i'd wish to output the lowest value:</p>
  
  <pre><code>public static void main(String[] args)
  {
      ...
      System.out.print(getLowestValue(mc.getMyValues1()));
      ...
  }
  </code></pre>
  
  <p>This edit goes to show that a strategy pattern isn't viable, since I have my functions in one class.</p>
  
  <p>Hopefully this clears up any confusion and I really hope you guys can help me solve this issue!</p>