Most efficient way to convert a single char to a CharSequence

Viewed 46115

What's the most efficient way to pass a single char to a method expecting a CharSequence?

This is what I've got:

textView.setText(new String(new char[] {c} ));

According to the answers given here, this is a sensible way of doing it where the input is a character array. I was wondering if there was a sneaky shortcut I could apply in the single-char case.

7 Answers

Adding to an answer mentioned above (link), adding an example to make things clearer

char c = 'a';
CharSequence cs = String.valueOf(c);
Related