title: Is thread safety an issue here?
body: <p><strong>Context :</strong> I have a service class which has a public <code>foo</code> method (which will be called from a rest controller), which in turn will call private <code>fooHelper</code> passing a list object which gets populated after few other private method calls in <code>fooHelper</code> . The reason for doing this was I wanted to keep the <code>foo</code> method short (Please suggest if my approach is wrong for creating private <code>fooHelper</code>).</p>
  <p><strong>Question:</strong> Could thread safety be an issue here ? in case multiple threads access <code>foo</code> method concurrently (In reference to passed list object) ? I am aware i can use Unmodifiable list but my question is specific to scenario whether current appraoch has thread safety issues ?</p>
  <p>I googled and read few articles and as per them this shouldnt be a problem as <code>foo</code> is creating <code>new List</code> so no threads will share the same list. Is my understanding correct ?</p>
  <p>Any help would be hugely appreciated , also excuse me if I have been unable to raise my question clearly. Any edits or suggestions are welcome.</p>
  <pre><code>@RequiredArgsConstructor
  @Service
  public class A {
  
  
      @Override
      public List&lt;RoundUpResponse&gt; foo(String token) {
  
          final List&lt;RoundUpResponse&gt; roundUpResponseList = new ArrayList&lt;&gt;();
          final Accounts accounts = getAccounts(token);
          final List&lt;Account&gt; accountList = accounts.getAccounts();
  
          accountList.forEach(account -&gt; fooHelper(token, roundUpResponseList, account));
          return roundUpResponseList;
      }
  
  private void fooHelper(String token, List&lt;RoundUpResponse&gt; roundUpResponseList, Account account) {
          final FeedItems transactionFeed = getTransactionFeed(token, account); // private
          final SavingsGoal savingsGoal = getSavingsGoal(token, account); // private
          final Long spareChange = calculateSpareChange(transactionFeed, savingsGoal); // private
          final SavingsGoalTopUp savingsGoalTopUpPayload = createTopUpPayload(account, // privatespareChange);
          final String savingsGoalTransferId = topUpSavingsGoal(token, account, savingsGoal, savingsGoalTopUpPayload); // private
          roundUpResponseList.add(roundUpResponseService.createResponsePerAccount(account, savingsGoal.getName(), savingsGoalTopUpPayload, savingsGoalTransferId)); // private
      }
  </code></pre>