# Stacks: Reversing a string

**URL:** <https://forum.codewithmosh.com/t/stacks-reversing-a-string/1192>\
**Category:** Data Structures\
**Created:** [December 9, 2020, 3:01am UTC](https://forum.codewithmosh.com/t/stacks-reversing-a-string/1192 "2020-12-09T03:01:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kalhari](https://avatars.discourse-cdn.com/v4/letter/k/8797f3/32.png) [@Kalhari](https://forum.codewithmosh.com/u/Kalhari)\
**Post date:** [December 9, 2020, 3:01am UTC](https://forum.codewithmosh.com/t/stacks-reversing-a-string/1192/1 "2020-12-09T03:01:34Z")

</div>

Isn’t it a good idea to use a StringBuilder instead of a StringBuffer unless there is a specific need for things to be thread safe?

---

<div class="post-metadata">

**Author:** ![jmrunkle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/jmrunkle/32/3765_2.png) [@jmrunkle](https://forum.codewithmosh.com/u/jmrunkle)\
**Post date:** [August 3, 2022, 2:14am UTC](https://forum.codewithmosh.com/t/stacks-reversing-a-string/1192/2 "2022-08-03T02:14:08Z")

</div>

Yes, from the Javadoc:

> Where possible, it is recommended that this class be used in preference to StringBuffer as it will be faster under most implementations.
