Werte einer ArrayList miteinander addieren7. Mai 2009ArrayList mit int-Werten sortieren11. I'm new to the concept of arraylist.
I had make a few line program code. Generics in Java is not applicable to primitive types as in int. In Java generic type arguments must be objects.
It seems I can do List myList = new ArrayList(); and add int into this list.
When you add int to this list, it is automatically boxed to Integer wrapper . I want to declare an ArrayList of type integer. ArrayList can only reference types, not primitives. Java Collections can only hold objects. This Java tutorial uses an ArrayList of Integer values to store int values.
This Java example page uses the ArrayList. It adds strings and integers and tests performance. Sehen wir mal, was passiert, wenn wir eine ArrayList mit int-Werten erzeugen wollen.
Keine Kommentare:
Kommentar veröffentlichen
Hinweis: Nur ein Mitglied dieses Blogs kann Kommentare posten.