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.

Is arr.__len__() the preferred way to get the length of an array in Python?

In Python, is the following the only way to get the number of elements? arr.__len__() If so, why the …

python arrays methods
Get all unique values in a JavaScript array (remove duplicates)

I have an array of numbers that I need to make sure are unique. I found the code snippet below …

javascript arrays unique
Determine whether an array contains a value

I need to determine if a value exists in an array. I am using the following function: Array.prototype.contains = …

javascript arrays contains
Remove duplicate values from JS array

I have a very simple JavaScript array that may or may not contain duplicates. var names = ["Mike","Matt","Nancy","Adam","…

javascript arrays duplicates unique
How to check if an object is an array?

I'm trying to write a function that either accepts a list of strings, or a single string. If it's a …

javascript arrays javascript-objects
Find object by id in an array of JavaScript objects

I've got an array: myArray = [{'id':'73','foo':'bar'},{'id':'45','foo':'bar'}, etc.] I'm unable to change …

javascript jquery arrays javascript-objects
How to initialize an array in Java?

I am initializing an array like this: public class Array { int data[] = new int[10]; /** Creates a new instance of Array */ …

java arrays initialization
Convert ArrayList<String> to String[] array

I'm working in the android environment and have tried the following code, but it doesn't seem to be working. String [] …

java arrays arraylist
Create ArrayList from array

I have an array that is initialized like: Element[] array = {new Element(1), new Element(2), new Element(3)}; I would like to …

java arrays arraylist type-conversion
How to convert jsonString to JSONObject in Java

I have String variable called jsonString: {"phonetype":"N95","cat":"WP"} Now I want to convert it into JSON Object. I …

java arrays json parsing