本文介绍了Java的优化VS串字符数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个程序我写,我做了很多的字符串操作。我试图提高性能和使用,如果字符数组会显示一个体面的性能提升很纳闷。有什么建议?

In a program I am writing I am doing a lot of string manipulation. I am trying to increase performance and am wondering if using char arrays would show a decent performance increase. Any suggestions?

推荐答案

什么样的​​操纵你在干什么?您可以张贴code样?

What kind of manipulation are you doing? Can you post a code sample?

您可能想看看它实现。

You may want to take a look at StringBuilder which implements CharSequence to improve performance. I'm not sure you want to roll your own. StringBuilder isn't thread safe btw... if you want thread safety look at StringBuffer.

这篇关于Java的优化VS串字符数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 21:47