且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

什么是最有效的算法为扭转在Java中的字符串?

更新时间:2023-11-25 15:20:28

你说你想知道最有效的方式,你不想知道的一些标准,这样做的内置方式。然后,我对你说:RTSL(读取源,卢克):

You say you want to know the most efficient way and you don't want to know some standard built-in way of doing this. Then I say to you: RTSL (read the source, luke):

查看源$ C ​​$下 AbstractStringBuilder #reverse ,这被称为StringBuilder的#相反。我敢打赌,它的一些东西,你就不会认为是一个强大的反向操作。

Check out the source code for AbstractStringBuilder#reverse, which gets called by StringBuilder#reverse. I bet it does some stuff that you would not have considered for a robust reverse operation.