Top "Arrays" questions

An array is an ordered linear data structure consisting of a collection of elements (values, variables, or references), each identified by one or more indexes.

Get the first element of an array

I have an array: array( 4 => 'apple', 7 => 'orange', 13 => 'plum' ) I would like to get the first element of …

php arrays
How do I find the length of an array?

Is there a way to find how many values an array has? Detecting whether or not I've reached the end …

c++ arrays
Deleting array elements in JavaScript - delete vs splice

What is the difference between using the delete operator on the array element as opposed to using the Array.splice …

javascript arrays element delete-operator array-splice
Converting array to list in Java

How do I convert an array to a list in Java? I used the Arrays.asList() but the behavior (and …

java arrays list data-conversion
Loop through an array of strings in Bash?

I want to write a script that loops through 15 strings (array possibly?) Is that possible? Something like: for databaseName in …

arrays bash shell
How to add new elements to an array?

I have the following code: String[] where; where.append(ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1"); where.append(ContactsContract.Contacts.IN_VISIBLE_…

java arrays string
How to find the sum of an array of numbers

Given an array [1, 2, 3, 4], how can I find the sum of its elements? (In this case, the sum would be 10.) I …

javascript jquery arrays
How do I check in JavaScript if a value exists at a certain array index?

Will this work for testing whether a value at position index exists or not, or is there a better way: …

javascript arrays
How to merge two arrays in JavaScript and de-duplicate items

I have two JavaScript arrays: var array1 = ["Vijendra","Singh"]; var array2 = ["Singh", "Shakya"]; I want the output to be: var …

javascript arrays merge
Convert a PHP object to an associative array

I'm integrating an API to my website which works with data stored in objects while my code is written using …

php arrays