Stefan Rusu
Stefan Rusu

Reputation: 39

How to fix the inner assignment in this case?

I'm working on my project and the last problem is here, how can I respect the InnerAssignmentCheck at line 3?

public void add(Account account) {
        if (tail == null) {
            head = tail = new Node(account, null);
        }
        else {
            tail.next = new Node(account, null);
            tail = tail.next;
        }
        size++;
    }

Upvotes: 0

Views: 517

Answers (1)

user14971157
user14971157

Reputation:

Documentation of InnerAssignmentCheck (my emphasis):

Rationale: With the exception of for iterators, all assignments should occur in their own toplevel statement to increase readability.

Upvotes: 1

Related Questions