# Vectors? (The "dynamic array" type of vectors, not the "value and direction" type)

**URL:** <https://discourse.processing.org/t/vectors-the-dynamic-array-type-of-vectors-not-the-value-and-direction-type/27919>\
**Category:** Beginners\
**Created:** [February 18, 2021, 7:28pm UTC](https://discourse.processing.org/t/vectors-the-dynamic-array-type-of-vectors-not-the-value-and-direction-type/27919 "2021-02-18T19:28:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ProgrammingN00b](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@ProgrammingN00b](https://discourse.processing.org/u/ProgrammingN00b)\
**Post date:** [February 18, 2021, 7:28pm UTC](https://discourse.processing.org/t/vectors-the-dynamic-array-type-of-vectors-not-the-value-and-direction-type/27919/1 "2021-02-18T19:28:34Z")

</div>

Hello everybody!  
I have had a bit of programming experience with C++ but found it very hard to make anything else then simple “command line applications” with it.  
So looking for some “beginner friendly GUI stuff”, I came across processing.

So far I have written some small programms, messing around with creating simple GUIs and stuff like that.

But there is one thing that seems to be “missing”.  
Vectors!

I mean there is the PVector thing, but that is like an actual “vector” as in it has a value and a direction.  
I mean the “dynamic array” thing that is called vector.

Is there such a thing?

Yes, I know about “Table” and that that is basically like a dynamic 2D array (you can add cols / rows during runtime).  
But you can’t use custom classes /objects with that!

So, am I missing something obvious or is there no such thing in processing?  
If that is the case, what else are you supposed to use to do things like handle multiple values in a dynamic array?

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [February 18, 2021, 7:34pm UTC](https://discourse.processing.org/t/vectors-the-dynamic-array-type-of-vectors-not-the-value-and-direction-type/27919/2 "2021-02-18T19:34:44Z")

</div>

I am not sure if I know what a vector is (in your sense).

- But you can use an ArrayList (add and remove are commands), [ArrayList \ Language (API) \ Processing 3+](https://www.processing.org/reference/ArrayList.html) . Here you can store your own objects in.

- Also interesting: HashMap which is like associative arrays : [HashMap \ Language (API) \ Processing 3+](https://www.processing.org/reference/HashMap.html) . Here a String refers to your own objects.

See also simpler IntDict, FloatDict, and StringDict classes.

---

<div class="post-metadata">

**Author:** ![ProgrammingN00b](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@ProgrammingN00b](https://discourse.processing.org/u/ProgrammingN00b)\
**Post date:** [February 18, 2021, 7:41pm UTC](https://discourse.processing.org/t/vectors-the-dynamic-array-type-of-vectors-not-the-value-and-direction-type/27919/3 "2021-02-18T19:41:45Z")

</div>

Thanks for that quick reply!  
This is what I mean: [vector - C++ Reference](https://www.cplusplus.com/reference/vector/vector/)  
It’s a thing in C++, maybe it is just a thing there and not in other languages …

Does that array thing also work with “multidimensional arrays” (2 dimensional, 3 dimensional, …)?

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [February 18, 2021, 7:55pm UTC](https://discourse.processing.org/t/vectors-the-dynamic-array-type-of-vectors-not-the-value-and-direction-type/27919/4 "2021-02-18T19:55:27Z")

</div>

> [@ProgrammingN00b](#):
>
> Does that array thing also work with “multidimensional arrays” (2 dimensional, 3 dimensional, …)?

ArrayList can do this but I think this is not very transparent.

But you can also use array

There are other data structures in Java that you can use here but they are not documented on the processing reference page. E.g. Collection or Iterable

---

<div class="post-metadata">

**Author:** ![ProgrammingN00b](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@ProgrammingN00b](https://discourse.processing.org/u/ProgrammingN00b)\
**Post date:** [February 18, 2021, 7:57pm UTC](https://discourse.processing.org/t/vectors-the-dynamic-array-type-of-vectors-not-the-value-and-direction-type/27919/5 "2021-02-18T19:57:19Z")

</div>

Ok …  
I will try to use ArrayList then …

Thanks!

EDIT:  
I just had a look at the documentation for ArrayList and it looks EXACTLY like what I was looking for!  
Thanks again!
