Class EnhancedStack<E>

java.lang.Object
io.toro.martini.util.EnhancedStack<E>

public final class EnhancedStack<E> extends Object
Stack that avoids duplicated element. If an duplicated element is pushed, instead of inserting the element into the stack resulting in increase of stack size it will increment the item count counter instead.

Caution when using this class in multiple thread as this class is not thread safe.

  • Constructor Details

    • EnhancedStack

      public EnhancedStack()
  • Method Details

    • getInternalStack

      Stack<EnhancedStack<E>.io.toro.martini.util.EnhancedStack.Item> getInternalStack()
    • peek

      public Optional<E> peek()
    • push

      public Optional<E> push(E item)
    • size

      public int size()
    • empty

      public boolean empty()
    • pop

      public Optional<E> pop()