I have 3 booleans which indicate if an int should be added to a list or not, then I would like to use TextUtils.join() on this list.
How should I proceed ?
ArrayList<Integer> types = new ArrayList<Integer>();
if (m_bWithA) {
types.add(this.TYPE_A); //TYPE_A is an int
}
if (m_bWithB) {
types.add(this.TYPE_B);
}
if (m_bWithC) {
types.add(this.TYPE_C);
}
TextUtils.join("|", types);
But it says that we can only use TextUtils.join() on Object[].
Should I use another function or a different type of object ?
use
TextUtils.join(types.toArray())