# What's the good way to add a new item in array?

**URL:** <https://forum.dfinity.org/t/whats-the-good-way-to-add-a-new-item-in-array/10993>\
**Category:** Developers\
**Tags:** Functional-Programming\
**Created:** [February 20, 2022, 1:06am UTC](https://forum.dfinity.org/t/whats-the-good-way-to-add-a-new-item-in-array/10993 "2022-02-20T01:06:53Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![mbeekman](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/mbeekman/32/2675_2.png) [@mbeekman](https://forum.dfinity.org/u/mbeekman)\
**Post date:** [March 27, 2022, 6:49pm UTC](https://forum.dfinity.org/t/whats-the-good-way-to-add-a-new-item-in-array/10993/6 "2022-03-27T18:49:56Z")

</div>

ie. if I have the following:

```auto

return Array.append<Project>(theProjectsNew, [newProject]);

```

which appends a new object “newProject” to an array called “theProjectsNew”

and replace it with:

```auto

let theProjectsBuffer : Buffer.Buffer = Buffer.Buffer(theProjectsNew.size());

for (x in theProjectsNew.vals()) {

theProjectsBuffer.add(x);

};

theProjectsBuffer.add(newProject);

return theProjectsBuffer.toArray();

```

the programatic results are the same … and the warning goes away … is this a valid way forward? and leave things otherwise as stable arrays?

---

_[View the full topic](https://forum.dfinity.org/t/whats-the-good-way-to-add-a-new-item-in-array/10993)._
