Parse.com的独特价值

时间:2015-04-12 02:12:35

标签: android parse-platform

我正在检索Parse中的城市列表。

mMidwifeLocation = users;
String[] locations = new String[mMidwifeLocation.size()];
int i = 0;
for(ParseUser user : mMidwifeLocation) {
  locations[i] = user.getString("city");
  i++;
}

在此范围内,我想要不同的值,并且没有空值。有人可以给我一个如何做到这一点的帮助吗?

1 个答案:

答案 0 :(得分:0)

这应该是好的。 如果不长,不是那么低效。

mMidwifeLocation = users;
String[] locations = new String[mMidwifeLocation.size()];
String check;
int i = 0;
for(ParseUser user : mMidwifeLocation) {
    check=user.getString("city");
    if(check!=null){
       if(!Arrays.asList(locations).contains(check)){
            locations[i] = user.getString("city");
         }
    }             
    i++;
 }
相关问题