---
title: "小知识：JDK5.0，StringBuilder:单个线程使用的更快的StringBuffer等价类"
author: "llade"
date: "2008-06-09T17:32:09Z"
tags: []
slug: "jdk5-0-stringbuilder-stringbuffer"
draft: false
lastmod: "2008-06-09T17:32:09Z"
id: 201525
url: "https://llade.iteye.com/blog/201525"
---

需要多线程修改字符串序列用StringBuffer.单线程使用StringBuilder。
Java API doc：
> 通常应该优先使用 StringBuilder 类，因为它支持所有相同的操作，但由于它不执行同步，所以速度更快