D
D
Dmitry072016-08-04 17:01:37
Java
Dmitry07, 2016-08-04 17:01:37

Why is the getSortedList() method called without a reference to the original list?

Good time knock.
There is an example of sorting a list.
Within the application, the resulting list is specified as follows:
ArrayList<Data> sortedList = getSortedList();
The getSortedList() method itself operates on a copy of the original list, eventually returning a sortedCopy.
However, the question arises: why is this method called without a reference to the original list, but a record like this:

ArrayList<Data> sortedList = originalList.getSortedList();

will be wrong?
Thanks to.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sanan Yuzb, 2016-08-04
@Sanan07

Well, probably the method is static and in the class there is only one field describing the list.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question