java/lang/Stack

David Young dyoung at baltazar.baltazar.org
Sat Aug 22 16:27:02 PDT 1998


	Shouldn't thse Stack methods (and others) be atomic?

On Sat, Aug 22, 1998 at 02:53:00PM -0700, Archie Cobbs wrote:
> public Object peek() throws EmptyStackException {
> 	try {
> 		return elementAt(size() - 1);
> 	} catch (ArrayIndexOutOfBoundsException _) {
> 		throw new EmptyStackException();
> 	}
> }
> 
> public Object pop() throws EmptyStackException {
> 	Object peeked = peek();
> 
> 	removeElementAt(size() - 1);
> 	return peeked;
> }

-- 
dyoung at pobox.com
    ``Ya know, a dyoung, as in `The African dyoung stays in its cool
burrow during the daytime, coming out only at night to forage for
food.'''


More information about the kaffe mailing list