Create a List of primitive int?

后端 未结 10 1959
夕颜
夕颜 2020-11-27 12:43

Is there a way to create a list of primitive int or any primitives in java like following?

List myList = new ArrayList();
10条回答
  •  悲&欢浪女
    2020-11-27 13:08

    Try using the ArrayIntList from the apache framework. It works exactly like an arraylist, except it can hold primitive int.

    More details here -

    https://commons.apache.org/dormant/commons-primitives/apidocs/org/apache/commons/collections/primitives/ArrayIntList.html

提交回复
热议问题