简体   繁体   English

Flickrj-getPublicGroups罕见的返回类型

[英]Flickrj - getPublicGroups uncommon return type

Reading the docs for Flickrj 1.2 阅读Flickrj 1.2的文档

http://flickrj.sourceforge.net/api/com/aetrion/flickr/people/PeopleInterface.html#getPublicGroups(java.lang.String)

I'm trying to the public groups for users but it seems the return type is java.util.Collection 我正在尝试向用户公开组,但似乎返回类型为java.util.Collection

public java.util.Collection getPublicGroups(java.lang.String userId)

And I'm stumped as to how I can get the group names for a user. 我很困惑如何获取用户的组名。 If I print the output for 如果我打印输出

people.getPublicGroups(userID);

I get: 我得到:

[com.aetrion.flickr.groups.Group@3f1179, com.aetrion.flickr.groups.Group@945b95.... etc

It's not what I'm after and I'm stuck. 这不是我追求的目标,而是被困住了。

I've solved it. 我已经解决了

The Collection the method getPublicgroups returned was a collection of Groups. 方法getPublicgroups返回的Collection是Groups的集合。

So I assigned the collection to a collection type. 因此,我将集合指定为集合类型。 Used an iterator to loop the elements in the collection and casted each element to the Group class. 使用迭代器循环集合中的元素,并将每个元素转换为Group类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM