class Node {
    /**
     * user id.
     */
    private final String userId;
    /**
     * User Account.
     */
    private UserAccount userAccount;
    /**
     * previous.
     */
    private Node previous;
    /**
     * next.
     */
    private Node next;

    /**
     * Node definition.
     *
     * @param id      String
     * @param account {@link UserAccount}
     */
    Node(final String id, final UserAccount account) {
      this.userId = id;
      this.userAccount = account;
    }
  }

  /**
   * Capacity of Cache.
   */
  private int capacity;
  /**
   * Cache {@link HashMap}.
   */
  private Map<String, Node> cache = new HashMap<>();
  /**
   * Head.
   */
  private Node head;
  /**
   * End.
   */
  private Node end;

  /**
   * Constructor.
   *
   * @param cap Integer.
   */
  public LruCache(final int cap) {
    this.capacity = cap;
  }

  /**
   * Get user account.
   *
   * @param userId String
   * @return {@link UserAccount}
   */
  public UserAccount get(final String userId) {
    if (cache.containsKey(userId)) {
      var node = cache.get(userId);
      remove(node);
      setHead(node);
      return node.userAccount;
    }
    return null;
  }

  /**
   * Remove node from linked list.
   *
   * @param node {@link Node}
   */
  public void remove(final Node node) {
    if (node.previous != null) {
      node.previous.next = node.next;
    } else {
      head = node.next;
    }
    if (node.next != null) {
      node.next.previous = node.previous;
    } else {
      end = node.previous;
    }
  }

  /**
   * Move node to the front of the list.
   *
   * @param node {@link Node}
   */
  public void setHead(final Node node) {<FILL_FUNCTION_BODY>

    node.next = head;
    node.previous = null;
    if (head != null) {
      head.previous = node;
    }
    head = node;
    if (end == null) {
      end = head;
    }
  
<no_super_class>