org.apache.commons.collections
Class StringStack

java.lang.Object
  |
  +--org.apache.commons.collections.StringStack
All Implemented Interfaces:
java.io.Serializable

Deprecated. This class is not a Stack, it is a String utility. As such it is deprecated in favour of the StringUtils class in the [lang] project.

public class StringStack
extends java.lang.Object
implements java.io.Serializable

This class implements a stack for String objects.

This class provides a way to collect a list of unique strings and join them with an optional separator.

Since:
2.0
Version:
$Id: StringStack.java,v 1.3.2.1 2004/05/22 12:14:01 scolebourne Exp $
Author:
John D. McNally, Daniel Rall, Stephen Colebourne
See Also:
Serialized Form

Constructor Summary
StringStack()
          Deprecated. Creates an empty instance.
 
Method Summary
 StringStack add(java.lang.String s)
          Deprecated. Adds the String to the collection if it does not already contain it.
 StringStack addAll(StringStack ss)
          Deprecated. Adds all Strings in the given StringStack to the collection (skipping those it already contains)
 void clear()
          Deprecated. Clears the stack.
 boolean contains(java.lang.String s)
          Deprecated. Returns whether this stack contain the specified text.
 boolean empty()
          Deprecated. Whether the stack is empty.
 boolean equals(java.lang.Object ssbuf)
          Deprecated. Compares two StringStacks.
 java.lang.String get(int i)
          Deprecated. Get a string off the stack at a certain position.
 int size()
          Deprecated. Returns the size of the stack.
 java.lang.String toString()
          Deprecated. Converts the stack to a single String with no separator.
 java.lang.String toString(java.lang.String separator)
          Deprecated. Converts the stack to a single String.
 java.lang.String[] toStringArray()
          Deprecated. Turns this stack into an array.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringStack

public StringStack()
Deprecated. 
Creates an empty instance.

Method Detail

add

public StringStack add(java.lang.String s)
Deprecated. 
Adds the String to the collection if it does not already contain it.

Parameters:
s - The String object to add to this stack (if it is not null and doesn't already exist in the stack).
Returns:
A reference to this stack (useful for when this method is called repeatedly).

addAll

public StringStack addAll(StringStack ss)
Deprecated. 
Adds all Strings in the given StringStack to the collection (skipping those it already contains)

Parameters:
ss - The stack of String objects to add to this stack (if it is not null and doesn't already exist in the stack).
Returns:
A reference to this stack (useful for when this method is called repeatedly).

clear

public void clear()
Deprecated. 
Clears the stack.


contains

public boolean contains(java.lang.String s)
Deprecated. 
Returns whether this stack contain the specified text.

Parameters:
s - The text to search for.
Returns:
Whether the stack contains the text.

empty

public final boolean empty()
Deprecated. 
Whether the stack is empty.

Returns:
Whether the stack is empty.

get

public java.lang.String get(int i)
Deprecated. 
Get a string off the stack at a certain position.

Parameters:
i - The position.
Returns:
A the string from the specified position.

size

public final int size()
Deprecated. 
Returns the size of the stack.

Returns:
The size of the stack.

toString

public java.lang.String toString()
Deprecated. 
Converts the stack to a single String with no separator.

Overrides:
toString in class java.lang.Object
Returns:
The stack elements as a single block of text.

toString

public java.lang.String toString(java.lang.String separator)
Deprecated. 
Converts the stack to a single String.

Parameters:
separator - The text to use as glue between elements in the stack.
Returns:
The stack elements--glued together by separator--as a single block of text.

equals

public boolean equals(java.lang.Object ssbuf)
Deprecated. 
Compares two StringStacks. Considered equal if the toString() method returns such.

Overrides:
equals in class java.lang.Object

toStringArray

public java.lang.String[] toStringArray()
Deprecated. 
Turns this stack into an array.

Returns:
This stack as an array.


Copyright © 2001-2004 The Apache Software Foundation. All Rights Reserved.