About 52 results
Open links in new tab
  1. java - Create a List of primitive int? - Stack Overflow

    Aug 2, 2013 · List<Integer> list = new ArrayList<>(); With autoboxing in Java the primitive type int will become an Integer when necessary. Autoboxing is the automatic conversion that the Java compiler …

  2. How to convert int[] into List<Integer> in Java? - Stack Overflow

    Jul 2, 2009 · How do I convert int[] into List<Integer> in Java? Of course, I'm interested in any other answer than doing it in a loop, item by item. But if there's no other answer, I'll pick that one as the …

  3. Java integer list - Stack Overflow

    I am trying to make java go trough a list of numbers. It chooses the first one, gives this as output, waits/sleeps like 2000 milliseconds and then give the next one as output, waits 2000 millisecon...

  4. How can I convert List<Integer> to int [] in Java? [duplicate]

    How can I convert a List<Integer> to int[] in Java? I'm confused because List.toArray() actually returns an Object[], which can be cast to neither Integer[] nor int[]. Right now I'm using a loop to do so:

  5. how to iterate in List<List<Integer>> in java and set their values as ...

    Aug 25, 2019 · List<List<Int>> arrayList = new ArrayList(); //Java usually infers type parameters in cases as these for(int i = 0; i < desiredSize; i++){ List<Int> listAtI = new ArrayList (); for(int j = 0; j < …

  6. arrays - Java ArrayList for integers - Stack Overflow

    Jan 20, 2013 · I have values that I'd like to add into an ArrayList to keep track of what numbers have shown up. The values are integers so I created an ArrayList; ArrayList&lt;Integer[]&gt; list = new …

  7. ArrayList of int array in java - Stack Overflow

    May 7, 2012 · 85 First of all, for initializing a container you cannot use a primitive type (i.e. int; you can use int[] but as you want just an array of integers, I see no use in that). Instead, you should use …

  8. java - How to sort a List/ArrayList? - Stack Overflow

    Apr 27, 2013 · I have a List of Double objects in Java. I want to sort the ArrayList in descending order. Input ArrayList:

  9. Initialize List<List<Integer>> in Java - Stack Overflow

    May 22, 2015 · List<ArrayList<Integer>> list = new ArrayList<ArrayList<Integer>>(); Note that the inner List has to be an implementation of the List interface, e.g., ArrayList. Since List is an interface, one …

  10. Java, how to remove an Integer item in an ArrayList

    Feb 15, 2014 · ArrayList#remove(int) that takes an index to remove. With an ArrayList<Integer>, removing an integer value like 2, is taken as index, as remove(int) is an exact match for this. It won't …