Ok, so here are my classes and interfaces:
public interface I_LinkedStack<T> extends Iterable<T> public LinkedStack implements I_LinkedStack -- private static class Node<T> -- private class LinkedListIterator implements java.util.Iterator<T> public Postfix<T>
Postfix is a class with the following methods:
public String iterableToString(Iterable<T> stack) public String infixToPostfix(String infixExpression) public int evaluatePostfix(String postfixExpression)
Everything is working fine with the exception of one thing. In my evaluatePostfix method I call iterableToString in order to print a stack declared locally within evaluatePostfix. Like this:
LinkedStack<Integer> stack = new LinkedStack<Integer>(); [...] System.out.println(this.iterableToString(stack));
But I'm getting the following error:
iterableToString(java.lang.Iterable<T>) in Postfix<T> cannot be applied to (LinkedStack<java.lang.Integer>)
Why? LinkedStack is an iterable type, and Integer is just fine for T. It might also be worth noting that it compiles if I try to pass it String, Integer, or any other class like that.