Is mutating object-parameters in a method(in Java) a bad practice?
问题 I have a question about mutating method-paramaters(which are objects) in a method. I read and heard multiple times that it is a bad practice to mutate a object in a method which was passed in as a paramater. As example: public void modifyList(List<Object> list) { list.add(new Object()); } Instead, the passed in Object should be copied, the mutation should be performed on the copied object and the copied object should be returned. As example: public List<Object> getModifiedList(List<Object>