About 527,000 results
Open links in new tab
  1. How do I declare and initialize an array in Java?

    Jul 29, 2009 · Static Array: Fixed size array (its size should be declared at the start and can not be changed later) Dynamic Array: No size limit is considered for this. (Pure dynamic arrays do …

  2. java - Are there reasons to prefer Arrays over ArrayLists ... - Stack ...

    May 12, 2014 · I think that the main difference of an array and a list is, that an array has a fixed length. Once it's full, it's full. ArrayLists have a flexible length and do use arrays to be …

  3. Array or List in Java. Which is faster? - Stack Overflow

    Apr 4, 2009 · Array vs. List choice is not so important (considering performance) in the case of storing string objects. Because both array and list will store string object references, not the …

  4. How do I determine whether an array contains a particular value in …

    Jul 15, 2009 · So if the array is created in sorted order the binary search is the fastest, otherwise the asList().contains would be the way to go. If you have many searches, then it may be …

  5. java - How to put a Scanner input into an array... for example a …

    Jul 10, 2018 · import java.util.Scanner; import java.util.ArrayList; public class Main { public static void main (String[]args) { System.out.println("Introduce the sequence of numbers to store in …

  6. java - Can an array be used as a HashMap key? - Stack Overflow

    You cannot use a plain Java Array as a key in a HashMap. (Well you can, but it won't work as expected.) (Well you can, but it won't work as expected.) But you could write a wrapper class …

  7. java - Use an array as a case statement in switch - Stack Overflow

    Dec 18, 2013 · for Java 1.6 and below use any other int literals, e.g. hex . public static final int TRUE_FALSE_TRUE_FALSE = 0xA; public static final int FALSE_FALSE_TRUE_FALSE = …

  8. arraylist - How to use an array list in Java? - Stack Overflow

    It is possible that future versions of the Java programming language will disallow the use of raw types. Effective Java 2nd Edition: Item 23: Don't use raw types in new code. If you use raw …

  9. java - How to use an Array with an If statement - Stack Overflow

    "If that array is at that first state of [1] ... it sets the array to arrayCount[2]" doesn't make sense. Arrays do not have "states". An array is an easy way to make a lot of variable or objects of the …

  10. Get only part of an Array in Java? - Stack Overflow

    The length of an array in Java is immutable. So, you need to copy the desired part into a new array. Use copyOfRange method from java.util.Arrays class: int[] newArray = …