Class RecursionGuard<T>


  • public class RecursionGuard<T>
    extends java.lang.Object
    A simple guard against infinite recursion. Can be used as a stack or a sink. It uses identity comparison to detect recursion. It is designed to cause minimal overhead for recursive structures that are not deeper than approx 15 elements and has less elements in the average case.
    • Constructor Summary

      Constructors 
      Constructor Description
      RecursionGuard()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      void done​(T element)  
      boolean tryNext​(T element)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RecursionGuard

        public RecursionGuard()
    • Method Detail

      • tryNext

        public boolean tryNext​(T element)
      • done

        public void done​(T element)
      • clear

        public void clear()