Arrays

  • static array

    • does not change size of array

    • has fixed memory, all in adjacent location to first element

  • terminology

    • array: An orderd list of elements

    • element: A member of an array

    • index: The position of the element in the array.

      • Starts counting at 0, so the first element is at index 0

    • size: how many elements can fit in the array

  • setting with size

  • setting with data

  • declaring a variable of array

  • Add data

  • remove data

  • read data

    • one element

    • reading all elements

    • reading elements depending on their index

    • ArrayIndexOutOfBoundsException

  • multi dimensional arrays

  • read from multidimenisonal arrays

  • adding data to mulitdimensional arrays

  • Copying arrays

  • searching

  • finding

  • slicing/sublist

  • comparing arrays

  • sorting arrays

  • Issues at runtime

    • use arraylist

  • Increasing size of arrays

Array VS Linked list

  • When to use Linked List over Arrays

    • Need constant-time insertions/deletions from the list

    • Dont konw size of List

    • Insert items in the middle of the lis

  • When to use arrays of linked list

    • you need indexed/random access to elements

    • Size already fixed at initiliaztion

    • Use less memory

  • ArrayList handle dynamic sizing of array

  • https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html

  • https://self-learning-java-tutorial.blogspot.co.uk/2014/02/one-dimensional-array.html

  • https://self-learning-java-tutorial.blogspot.co.uk/2014/02/multi-dimensional-arrays.html

  • https://www.geeksforgeeks.org/arrays-in-java/

  • https://www.tutorialspoint.com/java/java_arrays.htm

  • https://introcs.cs.princeton.edu/java/14array/

  • https://en.wikipedia.org/wiki/Array_data_structure

  • https://en.wikipedia.org/wiki/Array_data_type

  • https://completedeveloperpodcast.com/episode-78/

Last updated