structure5
Class AbstractLinear<E>
java.lang.Object
structure5.AbstractStructure<E>
structure5.AbstractLinear<E>
- All Implemented Interfaces:
- Iterable<E>, Linear<E>, Structure<E>
- Direct Known Subclasses:
- AbstractQueue, AbstractStack
public abstract class AbstractLinear<E>
- extends AbstractStructure<E>
- implements Linear<E>
An abstract implemtation of linear data structures. Linear structures have
completely determined add and remove methods.
Linear structures are often used to store the the state of a recursively
solved problem and stacks and queues are classic examples of such structures.
- See Also:
structure.Stack
,
structure.Queue
Method Summary |
boolean |
empty()
Determine if there are elements within the linear. |
E |
remove(E o)
Removes value from the linear structure. |
AbstractLinear
public AbstractLinear()
empty
public boolean empty()
- Determine if there are elements within the linear.
- Specified by:
empty
in interface Linear<E>
- Returns:
- true if the linear structure is empty; false otherwise
remove
public E remove(E o)
- Removes value from the linear structure.
Not implemented (by default) for linear classes.
- Specified by:
remove
in interface Structure<E>
- Parameters:
value
- value matching the value to be removed
- Returns:
- returns the value that was replaced, or null if none.