Search:

Type: Posts; User: curmudgeon

Search: Search took 0.09 seconds.

  1. Re: Trying to create an array of stacks that contain objects

    You're welcome and best of luck!
  2. Re: Trying to create an array of stacks that contain objects

    You seem to be calling get on an ArrayList and then trying to set that equal to a stack. That's not how ArrayLists or the get() method works. Why not instead simply call add(...) on the ArrayList if...
  3. Re: Trying to create an array of stacks that contain objects

    Where *exactly* was the error? Which line?

    You appear to be trying to call clear() on Stacks that don't yet exist. You do this 17 times on an *empty* List of Stacks.
  4. Re: Trying to create an array of stacks that contain objects

    There's nothing preventing you from creating an ArrayList<Stack<Card>> or a List<Stack<Card>>.

    For example, this will compile just fine:


    List<Stack<String>> myStrStackList = new...
  5. Re: Trying to create an array of stacks that contain objects

    Yes you did. Sorry about that.
  6. Re: Trying to create an array of stacks that contain objects

    Please post the entire error message.

    Likely though your problem is due to the limitations of Java generics including type erasure and that Java generics are not covariant. To read more on this,...
Results 1 to 6 of 6