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

sangria.validation.ValidatorStack.scala Maven / Gradle / Ivy

package sangria.validation

import scala.collection.mutable.ListBuffer

class ValidatorStack[T] {
  private val stack: ListBuffer[T] = ListBuffer.empty

  def push(element: T): Unit = stack.prepend(element)
  def pop(): T = stack.remove(0)
  def head = stack.head
  def headOption = stack.headOption
  def head(toDrop: Int) = stack.drop(toDrop).head
  def headOption(toDrop: Int) = stack.drop(toDrop).headOption
  def nonEmpty = stack.nonEmpty
  def toSeq: Seq[T] = stack.toSeq
}

object ValidatorStack {
  def empty[T] = new ValidatorStack[T]
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy