|
| |
| Java Collection Framework- Vector & Stack Classes |
A Vector is an historical collection
class that acts like a growable array,
but can store heterogeneous data elements.
Each
vector tries to optimize storage management
by maintaining a capacity and a capacityIncrement.
The capacity is always at least as
large as the vector size; it is usually
larger because as components are added
to the vector, the vector's storage
increases in chunks the size of capacityIncrement.
An application can increase the capacity
of a vector before inserting a large
number of components; this reduces
the amount of incremental reallocation.
The Stack class represents a last-in-first-out
(LIFO) stack of objects. It extends
class Vector with five operations
that allow a vector to be treated
as a stack. The usual push and pop
operations are provided, as well as
a method to peek at the top item on
the stack, a method to test for whether
the stack is empty, and a method to
search the stack for an item and discover
how far it is from the top.
Explore
the other Interface and Classes of
Java Collection Framework
Collection
Interface
Iterator
Interface
Set
Interface
List
Interface
ListIterator
Interface
Map
Interface
SortedSet
Interface
SortedMap
Interface
HashSet
& TreeSet Classes
ArrayList
& LinkedList Classes
HashMap
& Treemap Classes
Vector
and Stack Classes
|
|