Results 1 to 4 of 4
Thread: Merging stacks using Util Stack
- 11-08-2011, 12:25 PM #1
Member
- Join Date
- Feb 2011
- Posts
- 53
- Rep Power
- 0
Merging stacks using Util Stack
Hello, i was wondering if someone could tell me if there is a way to push an entire stack onto another stack. I looked google but cant find anything. Basically i want to take one stack and add all its contents in one go onto another stack.
Last edited by trishtren; 11-08-2011 at 12:31 PM.
- 11-08-2011, 01:23 PM #2
Member
- Join Date
- Feb 2011
- Posts
- 53
- Rep Power
- 0
Re: Merging stacks using Util Stack
Hello, i was wondering if someone could tell me if there is a way to push an entire stack onto another stack. I looked google but cant find anything. Basically i want to take one stack and add all its contents in one go onto another stack.
Ie something like this, but this doesent work
Java Code:Stack<box> BigBox= new Stack<box>(); BigBox.push(littlebox); //try to add another stack<box> little box to the bigger box
- 11-08-2011, 03:03 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
Re: Merging stacks using Util Stack
The Stack class extends the Vector class; the Vector class has addAll( ... ) methods.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 11-08-2011, 05:02 PM #4
Member
- Join Date
- Feb 2011
- Posts
- 53
- Rep Power
- 0
Similar Threads
-
Merging
By GoodOldDany in forum Java AppletsReplies: 3Last Post: 05-31-2011, 11:28 PM -
Demonstration of Stack class in java.util package
By Java Tip in forum java.langReplies: 0Last Post: 04-16-2008, 10:33 PM -
How to use Stack class in java.util package
By Java Tip in forum java.langReplies: 0Last Post: 04-16-2008, 10:32 PM -
Using java.util.Stack
By Java Tip in forum Java TipReplies: 0Last Post: 11-20-2007, 05:17 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks