小编use*_*345的帖子

整数ArrayList上的TextUtils.join

我有3个布尔值表示是否应该将int添加到列表中,然后我想TextUtils.join()在此列表中使用.

我该怎么办?

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);
Run Code Online (Sandbox Code Playgroud)

但它说,我们只能使用TextUtils.join()Object[].

我应该使用其他功能还是不同类型的对象?

java android arraylist

3
推荐指数
1
解决办法
4144
查看次数

标签 统计

android ×1

arraylist ×1

java ×1