# Choosing among array, arrayList, etc

**URL:** <https://discourse.processing.org/t/choosing-among-array-arraylist-etc/13956>\
**Category:** Beginners\
**Created:** [September 12, 2019, 9:09pm UTC](https://discourse.processing.org/t/choosing-among-array-arraylist-etc/13956 "2019-09-12T21:09:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdg](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@mdg](https://discourse.processing.org/u/mdg)\
**Post date:** [September 12, 2019, 9:09pm UTC](https://discourse.processing.org/t/choosing-among-array-arraylist-etc/13956/1 "2019-09-12T21:09:10Z")

</div>

I am somewhat new to Processing and Java-type syntax, but not new to programming in general. My project requires use of arrays, and I’ve been able to code everything out using for loops etc., but it’s tedious compared to what I know how to do using vectorized array helper functions in Python, R, or Matlab.

I’ve noticed in the Processing documentation that arrays have some helper functions and arrayLists or intLists have even more. After some searching around, I’ve found that array implementation in Java has even more helper functions through java.util.arrays (e.g., searching for a value and returning its index).

Can these be used in Processing? Or are we limited to the functions in the Processing documentation. Can a method from arrayList be used on an array?

Thanks!

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [September 12, 2019, 9:27pm UTC](https://discourse.processing.org/t/choosing-among-array-arraylist-etc/13956/2 "2019-09-12T21:27:05Z")

</div>

> [@mdg](#):
>
> Can these be used in Processing? Or are we limited to the functions in the Processing documentation.

The whole Java’s Standard API is available in Processing: ☕  
[Docs.Oracle.com/en/java/javase/11/docs/api/index.html](http://Docs.Oracle.com/en/java/javase/11/docs/api/index.html)

> [@mdg](#):
>
> Can a method from ArrayList be used on an array?

Java array got its own special syntax, like its `[]` access operator: 🧐

> **[\[\] (array access) / Reference](https://processing.org/reference/arrayaccess.html)**
>
> The array access operator is used to specify a location within an array. The data at this location can be defined with the syntax array\[element\] = value and read with the syntax value = arra…

While an ArrayList is a regular `class` like all the rest: 😳

> **[class / Reference](https://processing.org/reference/class.html)**
>
> Keyword used to indicate the declaration of a class. A class is a composite of fields (data) and methods (functions that are a part of the class) which may be instantiated as objects. The first lette…

[Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/util/ArrayList.html](http://Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/util/ArrayList.html)

> [@mdg](#):
>
> , but it’s tedious compared to what I know how to do using vectorized array helper functions in Python, R, or Matlab.

Processing got other “modes” besides default Java Mode. 👍  
Python & R modes are available to download from the PDE itself. 😇  
There are other flavors outside the PDE, like p5js, Pjs, Ruby, etc. 🕶

Although vanilla array & ArrayList (the most performant containers) are the most used containers in Java, we’ve also got HashMap, HashSet, ArrayDeque, LinkedList and many more: 🤑  
[Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/util/package-summary.html](http://Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/util/package-summary.html)

---

<div class="post-metadata">

**Author:** ![mdg](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@mdg](https://discourse.processing.org/u/mdg)\
**Post date:** [September 12, 2019, 9:55pm UTC](https://discourse.processing.org/t/choosing-among-array-arraylist-etc/13956/3 "2019-09-12T21:55:01Z")

</div>

> [@GoToLoop](#):
>
> Processing got other “modes” besides default Java Mode. 👍  
> Python & R modes are available to download from the PDE itself. 😇  
> There are other flavors outside the PDE, like p5js, Pjs, Ruby, etc. 🕶

Yes I saw those, but part of the reason for learning Processing was to force myself to learn Java syntax 🙂

Thanks for your answer! I think this clears up most of my confusion

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [September 12, 2019, 10:09pm UTC](https://discourse.processing.org/t/choosing-among-array-arraylist-etc/13956/4 "2019-09-12T22:09:47Z")

</div>

> [@mdg](#):
>
> , but part of the reason for learning Processing was to force myself to learn Java syntax 🙂

Some more tips about when to use array or ArrayList: 💡

- [Why use ArrayList instead of array with append()? - Processing 2.x and 3.x Forum](http://Forum.Processing.org/two/discussion/8080/why-use-arraylist-instead-of-array-with-append)

And general basic tutorials: 😋

- [Lesson: Language Basics (The Java™ Tutorials \> Learning the Java Language)](http://Docs.Oracle.com/javase/tutorial/java/nutsandbolts/index.html)
- [Java Tutorial](http://TutorialsPoint.com/java/)
