When.com Web Search

Search results

  1. Results From The WOW.Com Content Network
  2. String[][] arrays = new String[][] { array1, array2, array3, array4, array5 }; (The latter syntax can be used in assignments other than at the point of the variable declaration, whereas the shorter syntax only works with declarations.) answered Jan 24, 2011 at 10:54. Jon Skeet.

  3. Here's a simple method that will concatenate two arrays and return the result: public <T> T[] concatenate(T[] a, T[] b) { int aLen = a.length; int bLen = b.length ...

  4. (Pure dynamic arrays do not exist in Java. Instead, List is most encouraged.) To declare a static array of Integer, string, float, etc., use the below declaration and initialization statements.

  5. Converting array to list in Java - Stack Overflow

    stackoverflow.com/questions/2607289

    You can, however, have a List<Integer> using the Integer class that wraps the int primitive. Convert your array to a List with the Arrays.asList utility method. Integer[] numbers = new Integer[] { 1, 2, 3 }; List<Integer> list = Arrays.asList(numbers); See this code run live at IdeOne.com.

  6. Java Tutorials/Arrays. An array is a container object that holds a fixed number of values of a single type. The length of an array is established when the array is created. After creation, its length is fixed. Java Tutorials/The List interface

  7. Convert list to array in Java - Stack Overflow

    stackoverflow.com/questions/9572795

    In older Java versions using pre-sized array was recommended, as the reflection call which is necessary to create an array of proper size was quite slow. However since late updates of OpenJDK 6 this call was intrinsified, making the performance of the empty array version the same and sometimes even better, compared to the pre-sized version.

  8. Java Array Sort descending? - Stack Overflow

    stackoverflow.com/questions/1694751

    It's not directly possible to reverse sort an array of primitives (i.e., int[] arr = {1, 2, 3};) using Arrays.sort() and Collections.reverseOrder() because those methods require reference types (Integer) instead of primitive types (int).

  9. How to use java.util.Arrays - Stack Overflow

    stackoverflow.com/questions/5570882

    java.util.Arrays only exposes static methods, so you simply pass in your array and whatever other params are necessary for the particular method you are calling. For instance Arrays.fill(myarray,true) would fill a boolean array with the value true. Here is the javadoc for java.util.Arrays

  10. You can simply use the new Java 8 Streams but you have to work with int.. The stream method of the utility class Arrays gives you an IntStream on which you can use the min method.

  11. java - Create ArrayList from array - Stack Overflow

    stackoverflow.com/questions/157944

    Until Java 16 the javadoc stated: The behavior of this convenience method is identical to that of c.addAll(Arrays.asList(elements)), but this method is likely to run significantly faster under most implementations.