如何找到集合的长度?

2022-01-17 00:00:00 set android java

我正在尝试从偏好中找到一组长度.我厌倦了 set.length,但它不起作用.任何人都知道另一种方法来找到一个集合的长度?

I'm trying to find the lentgh of a set from a preference. I tired set.length, but it doesnt work. Anyone know another way to find a length of a set?

   set = prefs.getStringSet("key", null);
            int X = set.length; //it doesn't like length....

推荐答案

我相信你会想调用 set.size()

相关文章