 <p>You can simply overload the enqueue class to take both Dates and Integers. In either case, it sounds like you need a method getValue() in CInteger that lets you access the int value.</p> <pre><code>public class CInteger { //constructors, data public void getValue() { return i; } } </code></pre> <p>and then you can have two enqueue() methods in your other class:</p> <pre><code>public void enqueue(Date d) { add(tailIndex, d); } public void enqueue(CInteger i) { add(tailIndex, new Integer(i.getValue()); //access the int value and cast to Integer object } </code></pre> <p>And Java will know which one you are calling automatically based on the parameters.</p>