用户登录
用户注册

分享至

如何找到集合的长度?

  • 作者: 左医生
  • 来源: 51数据库
  • 2022-10-27

问题描述

我正在尝试从偏好中找到一组长度.我厌倦了 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()

软件
前端设计
程序设计
Java相关