Class Locked<Lock,​Item>

  • Type Parameters:
    Lock - The type of the lock
    Item - The type of the item being locked
    All Implemented Interfaces:
    Serializable

    public final class Locked<Lock,​Item>
    extends Object
    implements Serializable
    Represents an item that is locked by a specific lock. Contains both the lock and the item.
    Since:
    8.5.0
    See Also:
    Serialized Form
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • item

        public Item item()
        The item being locked.
        Returns:
        The item being locked
      • lock

        public Lock lock()
        The lock associated with the item.
        Returns:
        The lock associated with the item
      • of

        public static <Lock,​Item> Locked<Lock,​Item> of​(Lock lock,
                                                                   Item item)
        Creates a new locked instance with the given lock and item.
        Parameters:
        lock - the lock associated with the item
        item - the item being locked
        Returns:
        A new Locked instance
      • locked

        public static <Lock,​Item> Locked<Lock,​Item> locked​(Lock lock,
                                                                       Item item)
        Creates a new locked instance with the given lock and item.
        Parameters:
        lock - the lock associated with the item
        item - the item being locked
        Returns:
        A new Locked instance