Class Lazy.Concurrent<T>

  • All Implemented Interfaces:
    java.util.function.Supplier<T>, Lazy<T>
    Enclosing interface:
    Lazy<T>

    public static final class Lazy.Concurrent<T>
    extends java.lang.Object
    implements Lazy<T>
    Thread-safe implementation.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private T instance  
      private java.lang.Object lock  
      private java.util.function.Supplier<T> supplier  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Concurrent​(java.util.function.Supplier<T> supplier)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T get()  
      • Methods inherited from class java.lang.Object

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

      • lock

        private volatile java.lang.Object lock
      • supplier

        private volatile java.util.function.Supplier<T> supplier
      • instance

        private volatile T instance
    • Constructor Detail

      • Concurrent

        private Concurrent​(java.util.function.Supplier<T> supplier)
    • Method Detail

      • get

        @Nullable
        public final T get()
        Specified by:
        get in interface java.util.function.Supplier<T>