Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: copying and comparing stacks

  1. #1
    Member
    Join Date
    Feb 2011
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default copying and comparing stacks

    How would I create a shallow copy of a stack? The interface method which I must implement is:
    	MyStackInterface<T> copy();
    	// Returns a shallow copy of this stack

    It doesn't make sense to me that I return an interface....

    The other method that I must implement is:
    	boolean equals(MyStackInterface<T> s);
    	// Returns true if the contents of this Stack are equal to the contents of s
    	// Does not change the contents of s.

    Can anyone help me please?


  2. #2
    Member
    Join Date
    Oct 2011
    Posts
    42
    My Mood
    Sneaky
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default Re: copying and comparing stacks

    Are you looking for

    Thread.currentThread().getStackTrace();

    This will return an array of [StackTraceElement]s.

Similar Threads

  1. Copying Objects
    By MethodMan in forum Object Oriented Programming
    Replies: 3
    Last Post: November 15th, 2011, 03:41 AM
  2. need help copying (what is in address bar)
    By 3ammary in forum Java Networking
    Replies: 0
    Last Post: January 8th, 2011, 09:32 AM
  3. Help with Stacks
    By animelook in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 17th, 2010, 12:58 AM
  4. help for stacks
    By msa0127a in forum Algorithms & Recursion
    Replies: 0
    Last Post: October 3rd, 2010, 12:11 AM
  5. Palindrome Stacks
    By mgutierrez19 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 7th, 2010, 03:05 AM