Java中的CharSequence VS String? [英] CharSequence VS String in Java?

查看:183
本文介绍了Java中的CharSequence VS String?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android中编程,大多数文本值都在 CharSequence 中。

Programming in Android, most of the text values are expected in CharSequence.

为什么会这样?有什么好处,使用 CharSequence 超过字符串的主要影响是什么?

Why is that? What is the benefit, and what are the main impacts of using CharSequence over String?

在使用它们时,主要的区别是什么,预期会出现什么问题,从一个转换到另一个?

What are the main differences, and what issues are expected, while using them, and converting from one to another?

推荐答案

字符串是CharSequences ,所以你可以使用字符串而不用担心。 Android只是通过允许您指定其他CharSequence对象(如StringBuffers)来尝试提供帮助。

Strings are CharSequences, so you can just use Strings and not worry. Android is merely trying to be helpful by allowing you to also specify other CharSequence objects, like StringBuffers.

这篇关于Java中的CharSequence VS String?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆