Generics in Java are not applicable to primitive types as in int
. You should probably use wrapper types such as Integer
:
List<Integer> ints = ...
And, to access a List
, you need to use ints.get(index)
.
More Related Contents:
- How to arrange the datas to display in array by given string of days in java?
- How to create a Java ArrayList in C
- Why does my ArrayList contain N copies of the last item added to the list?
- How do I remove repeated elements from ArrayList?
- How to avoid “ConcurrentModificationException” while removing elements from `ArrayList` while iterating it? [duplicate]
- Why do I get an UnsupportedOperationException when trying to remove an element from a List?
- How to sort a List/ArrayList?
- Convert list to array in Java [duplicate]
- How do you cast a List of supertypes to a List of subtypes?
- Java List.add() UnsupportedOperationException
- In Java how do you sort one list based on another?
- How to randomize two ArrayLists in the same fashion?
- List versus ArrayList as reference type?
- How do I find out what type each object is in a ArrayList?
- How do I clone a generic List in Java?
- Modifier static is only allowed in constant variable declarations
- List
- Simple way to compare 2 ArrayLists
- What is a List vs. an ArrayList? [duplicate]
- Java: Casting from List to List when B implements A?
- Removing Duplicate Values from ArrayList
- Create a List of primitive int?
- Why can’t you have a “List” in Java? [duplicate]
- ArrayList vs LinkedList from memory allocation perspective
- Java Generic with ArrayList
- Finding out if a list of Objects contains something with a specified field value?
- How to remove common values from two array lists
- Java generics – ArrayList initialization
- Why does the ArrayList implementation use Object[]?
- What’s the difference between unbounded wildcard type List and raw type List?