Arrays.asList() doubt?

前端 未结 8 1263
粉色の甜心
粉色の甜心 2020-12-05 08:00

People say that asList method convert the array into list and its not copying, so every change in \'aList\' will reflect into \'a\'. So add new values in \'aLis

8条回答
  •  爱一瞬间的悲伤
    2020-12-05 08:55

    This List implementation you receive from Arrays.asList is a special view on the array - you can't change it's size.

    The return type of Arrays.asList() is java.util.Arrays.ArrayList which is often confused with java.util.ArrayList. Arrays.ArrayList simply shows the array as a list.

提交回复
热议问题