ENTDownloader
Gestionnaire de fichiers pour l'ENT de l'Université d'Auvergne
Développé par Kévin Subileau
Référence de la classe Stack< T >
The Stack
class represents a last-in-first-out (LIFO) stack of objects.
Plus de détails...
Fonctions membres publiques | |
Stack () | |
Creates an empty Stack. | |
Stack (Collection< T > c) | |
Creates a Stack containing the elements of the specified collection, in the order they are returned by the collection's iterator. | |
boolean | isEmpty () |
Returns true if this stack contains no elements. | |
T | peek () |
Retrieves, but does not remove, the head (first element) of this stack. | |
T | pop () |
Pops an element from this stack. | |
void | push (T item) |
Pushes an element onto this list. | |
Iterator< T > | iterator () |
Returns an iterator over the elements in this stack (from top of the stack to the bottom). | |
Iterator< T > | descendingIterator () |
Returns an iterator over the elements in this stack in reverse sequential order. |
Description détaillée
The Stack
class represents a last-in-first-out (LIFO) stack of objects.
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
.
This implementation uses a LinkedList instance to store the elements of the stack, where the last element of the LinkedList is the top of the Stack
.
- Paramètres:
-
T the type of elements held in this Stack
Documentation des constructeurs et destructeur
Stack | ( | ) |
Creates an empty Stack.
Stack | ( | Collection< T > | c | ) |
Creates a Stack containing the elements of the specified collection, in the order they are returned by the collection's iterator.
- Paramètres:
-
c the collection whose elements are to be placed into this Stack
Documentation des fonctions membres
Iterator<T> descendingIterator | ( | ) |
Returns an iterator over the elements in this stack in reverse sequential order.
The elements will be returned in order from last (bottom) to first (last).
- Renvoie:
- an iterator over the elements in this stack in reverse sequence
- Voir également:
- java.util.LinkedList.descendingIterator()
boolean isEmpty | ( | ) |
Returns true if this stack contains no elements.
This implementation returns size() == 0.
- Renvoie:
- true if this stack contains no elements.
Iterator<T> iterator | ( | ) |
Returns an iterator over the elements in this stack (from top of the stack to the bottom).
This implementation merely returns a LinkedList iterator over the stack.
- Renvoie:
- an iterator over the elements in this stack (from top of the stack to the bottom)
- Voir également:
- java.util.AbstractSequentialList.iterator()
T peek | ( | ) |
Retrieves, but does not remove, the head (first element) of this stack.
- Renvoie:
- the head of this stack, or null if this stack is empty.
T pop | ( | ) |
Pops an element from this stack.
In other words, removes and returns the first element of this stack.
This method is equivalent to java.util.LinkedList.removeFirst().
- Renvoie:
- the element at the front of this stack (which is the top of the stack represented by this stack), or null if this stack is empty.
void push | ( | T | item | ) |
Pushes an element onto this list.
In other words, inserts the element at the front of this stack.
This method is equivalent to java.util.LinkedList.addFirst(T).
- Paramètres:
-
item the element to push
La documentation de cette classe a été générée à partir du fichier suivant :