/
NikolayIvkin
/
TheAlgorithms
Обзор
Документация
Войти
/
NikolayIvkin
/
TheAlgorithms
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/main/java/com/thealgorithms/datastructures/stacks/Stack.java
51 строка
1 KB
Alex Klymenko
refactor: `StackArray` (#5349)
20 авг 2024, 13:10
Не верифицирован
20 авг 2024, 13:10
f5c0314
Код
Авторство
О чём код?
package com.thealgorithms.datastructures.stacks; /** * A generic interface for Stack data structures. * * @param <T> the type of elements in this stack */ public interface Stack<T> { /** * Adds an element to the top of the stack. * * @param value The element to add. */ void push(T value); /** * Removes the element at the top of this stack and returns it. * * @return The element popped from the stack. * @throws IllegalStateException if the stack is empty. */ T pop(); /** * Returns the element at the top of this stack without removing it. * * @return The element at the top of this stack. * @throws IllegalStateException if the stack is empty. */ T peek(); /** * Tests if this stack is empty. * * @return {@code true} if this stack is empty; {@code false} otherwise. */ boolean isEmpty(); /** * Returns the size of this stack. * * @return The number of elements in this stack. */ int size(); /** * Removes all elements from this stack. */ void makeEmpty(); }