I have a question while writing code that declares a simple array and adds it to the list.
int[] value = new int[]{1, 2, 3};
List<Integer> arrayToList = new ArrayList<>();
for (int number : value) {
arrayToList.add(number);
}
I want to know how list.add () works internally. if the "new" keyword is used for each element to create an instance. If not, I wonder if Integer.valueOf () is being used.
To summarize, each array element is a primitive type. I want to know how it works internally and converts it to a reference type.