/**
* Returns the index of the first occurrence of the object, starting from
* the top of the stack.
*
* @return the index of the first occurrence of the object, assuming that
* the topmost object on the stack has a distance of one.
* @param o
* the object to be searched.
*/
public synchronized int search(Object o) {}
在上面开发者很明确的给出了index的计数方式:假设堆栈上的最顶层的对象具有一个的距离,也就是最顶层的索引为1