You will need to implement a class that supports push and pop methods using APEX collection types, specifically, List. As this is an exercise for you, I leave it to you to figure out how to do this using the List type and various List instance methods
You will need to implement a class that supports push and pop methods using APEX collection types, specifically, List. As this is an exercise for you, I leave it to you to figure out how to do this using the List type and various List instance methods
You have an interesting choice. A natural implementation of Stack would be to use a Linked List, as it's easy to access the ends and to allow it to change size. A simpler solution in Apex would be to wrap the List object and let the platform deal with the demands of the list changing size. If it's based on Java's ArrayList it should do quite well, and I've found some parts of Apex can be upset by linked lists. (It seems to have anti-recursion protection when serialising things, for example saving state in stateful batch processes.)
Stacks are a computer science concept - see http://en.wikipedia.org/wiki/Stack_(abstract_data_type)
You will need to implement a class that supports push and pop methods using APEX collection types, specifically, List. As this is an exercise for you, I leave it to you to figure out how to do this using the List type and various List instance methods
All Answers
Or if you mean the Stack Collection class, there is no such collection class in Apex. The only collection are Lists, Maps and Sets.
Can you provide the reference link so we can get the context?
Regards,
Satish Kumar
actually this is the question in my assignment.There is no reference link.
Stacks are a computer science concept - see http://en.wikipedia.org/wiki/Stack_(abstract_data_type)
You will need to implement a class that supports push and pop methods using APEX collection types, specifically, List. As this is an exercise for you, I leave it to you to figure out how to do this using the List type and various List instance methods