Skip to content
Snippets Groups Projects
Select Git revision
  • ac3e362037a1b31c36a2dc49eb38320cf4906e79
  • main default protected
  • correction_video
  • going_further
  • ImprovedMouseInteraction
  • final2023
  • template
  • ModifGUI
8 results

ConstantCellInitializer.java

Blame
  • Forked from NAVES Guyslain / Game of life Template
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    stack.java 756 B
    public class stack {
    
        private Vector vector;
    
        public stack() {
            vector = new Vector();
        }
    
        public void push(int value) {
            vector.add(value);
        }
    
        public int peek() {
            if (vector.isEmpty()) {
                throw new IllegalStateException("La pile est vide");
            }
            return vector.get(vector.size() - 1);
        }
    
        public int pop() {
            if (vector.isEmpty()) {
                throw new IllegalStateException("La pile est vide");
            }
            int topElement = vector.get(vector.size() - 1);
            vector.resize(vector.size() - 1);
            return topElement;
        }
    
        public int size() {
            return vector.size();
        }
    
        public boolean isEmpty() {
            return vector.isEmpty();
        }
    }