且构网

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

在java中将字符串转换为整数的最有效方法

更新时间:2023-01-11 22:46:01

不要浪费时间思考它.只需选择一个似乎适合其余代码的代码(其他转换是否使用 .parse__() 或 .valueOf() 方法?使用它来保持一致).

Don't even waste time thinking about it. Just pick one that seems to fit with the rest of the code (do other conversions use the .parse__() or .valueOf() method? use that to be consistent).

试图决定哪个是***的"会分散您解决业务问题或实现功能的注意力.

Trying to decide which is "best" detracts your focus from solving the business problem or implementing the feature.

不要因为琐碎的细节而陷入困境.:-)

Don't bog yourself down with trivial details. :-)

附带说明一下,如果您的用例"正在为您的代码指定 java 对象数据类型 - 您的 BA 需要退出您的域.BA 需要定义业务问题",以及用户在解决问题时希望如何与应用程序交互.开发人员确定如何***地使用代码将该功能构建到应用程序中 - 包括处理数据的正确数据类型/对象.

On a side note, if your "use case" is specifying java object data types for your code - your BA needs to step back out of your domain. BA's need to define "the business problem", and how the user would like to interact with the application when addressing the problem. Developers determine how best to build that feature into the application with code - including the proper data types / objects to handle the data.