All Downloads are FREE. Search and download functionalities are using the official Maven repository.

encrywm.utils.Stack.scala Maven / Gradle / Ivy

There is a newer version: 0.3.2
Show newest version
package encrywm.utils

class Stack[T] {

  protected var stack: List[T] = List.empty

  def currentOpt: Option[T] = stack.headOption

  def lastOpt: Option[T] = stack.lastOption

  def push(e: T): Unit = {
    stack = e :: stack
  }

  def popHead(): Unit = {
    stack = stack.drop(1)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy