Class ThreadContext.EmptyThreadContextStack

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<java.lang.String>, java.util.Collection<java.lang.String>, ThreadContextStack, ThreadContext.ContextStack
    Enclosing class:
    ThreadContext

    private static class ThreadContext.EmptyThreadContextStack
    extends java.util.AbstractCollection<java.lang.String>
    implements ThreadContextStack
    An empty read-only ThreadContextStack.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Iterator<java.lang.String> EMPTY_ITERATOR  
      private static long serialVersionUID  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(java.lang.String e)  
      boolean addAll​(java.util.Collection<? extends java.lang.String> c)  
      java.util.List<java.lang.String> asList()
      Returns all the elements in the stack in a List.
      boolean containsAll​(java.util.Collection<?> c)  
      ThreadContext.ContextStack copy()
      Returns a copy of the ContextStack.
      boolean equals​(java.lang.Object o)  
      int getDepth()
      Returns the number of elements in the stack.
      ThreadContext.ContextStack getImmutableStackOrNull()
      Returns a ContextStack with the same contents as this ContextStack or null.
      int hashCode()  
      java.util.Iterator<java.lang.String> iterator()  
      java.lang.String peek()
      Returns the element at the top of the stack without removing it or null if the stack is empty.
      java.lang.String pop()
      Returns the element at the top of the stack.
      void push​(java.lang.String message)
      Pushes an element onto the stack.
      boolean removeAll​(java.util.Collection<?> c)  
      boolean retainAll​(java.util.Collection<?> c)  
      int size()  
      <T> T[] toArray​(T[] a)  
      void trim​(int depth)
      Trims elements from the end of the stack.
      • Methods inherited from class java.util.AbstractCollection

        clear, contains, isEmpty, remove, toArray, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        clear, contains, isEmpty, parallelStream, remove, removeIf, spliterator, stream, toArray, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Field Detail

      • EMPTY_ITERATOR

        private static final java.util.Iterator<java.lang.String> EMPTY_ITERATOR
    • Constructor Detail

      • EmptyThreadContextStack

        private EmptyThreadContextStack()
    • Method Detail

      • peek

        public java.lang.String peek()
        Description copied from interface: ThreadContext.ContextStack
        Returns the element at the top of the stack without removing it or null if the stack is empty.
        Specified by:
        peek in interface ThreadContext.ContextStack
        Returns:
        the element at the top of the stack or null if the stack is empty.
      • equals

        public boolean equals​(java.lang.Object o)
        Specified by:
        equals in interface java.util.Collection<java.lang.String>
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<java.lang.String>
        Overrides:
        hashCode in class java.lang.Object
      • toArray

        public <T> T[] toArray​(T[] a)
        Specified by:
        toArray in interface java.util.Collection<java.lang.String>
        Overrides:
        toArray in class java.util.AbstractCollection<java.lang.String>
      • add

        public boolean add​(java.lang.String e)
        Specified by:
        add in interface java.util.Collection<java.lang.String>
        Overrides:
        add in class java.util.AbstractCollection<java.lang.String>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> c)
        Specified by:
        containsAll in interface java.util.Collection<java.lang.String>
        Overrides:
        containsAll in class java.util.AbstractCollection<java.lang.String>
      • addAll

        public boolean addAll​(java.util.Collection<? extends java.lang.String> c)
        Specified by:
        addAll in interface java.util.Collection<java.lang.String>
        Overrides:
        addAll in class java.util.AbstractCollection<java.lang.String>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<java.lang.String>
        Overrides:
        removeAll in class java.util.AbstractCollection<java.lang.String>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<java.lang.String>
        Overrides:
        retainAll in class java.util.AbstractCollection<java.lang.String>
      • iterator

        public java.util.Iterator<java.lang.String> iterator()
        Specified by:
        iterator in interface java.util.Collection<java.lang.String>
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.String>
        Specified by:
        iterator in class java.util.AbstractCollection<java.lang.String>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<java.lang.String>
        Specified by:
        size in class java.util.AbstractCollection<java.lang.String>
      • getImmutableStackOrNull

        public ThreadContext.ContextStack getImmutableStackOrNull()
        Description copied from interface: ThreadContext.ContextStack
        Returns a ContextStack with the same contents as this ContextStack or null. Attempts to modify the returned stack may or may not throw an exception, but will not affect the contents of this ContextStack.
        Specified by:
        getImmutableStackOrNull in interface ThreadContext.ContextStack
        Returns:
        a ContextStack with the same contents as this ContextStack or null.