com.aspectran.core.util.ArrayStack Maven / Gradle / Ivy
Show all versions of aspectran-core Show documentation
/*
* Copyright (c) 2008-2019 The Aspectran Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aspectran.core.util;
import java.util.ArrayList;
import java.util.EmptyStackException;
/**
* An implementation of the {@link java.util.Stack} API that is based on an
* ArrayList
instead of a Vector
, so it is not
* synchronized to protect against multi-threaded access. The implementation
* is therefore operates faster in environments where you do not need to
* worry about multiple thread contention.
*
* The removal order of an ArrayStack
is based on insertion
* order: The most recently added element is removed first. The iteration
* order is not the same as the removal order. The iterator returns
* elements from the bottom up, whereas the {@link #pop()} method removes
* them from the top down.
*
* Unlike Stack
, ArrayStack
accepts null entries.
*
* Note: this class should be bytecode-identical to the
* version in commons collections. This is required to allow backwards
* compatibility with both previous versions of BeanUtils and also allow
* coexistence with both collections 2.1 and 3.0.
*
* @author Craig R. McClanahan
* @author Paul Jack
* @author Stephen Colebourne
* @see java.util.Stack
* @since Commons Collections 1.0
*/
public class ArrayStack extends ArrayList