code: public Collection<Group> getPublicGroups(String userId) throws FlickrException {
          List<Group> groups = new ArrayList<Group>();
  
          Map<String, Object> parameters = new HashMap<String, Object>();
          parameters.put("method", METHOD_GET_PUBLIC_GROUPS);
  
          parameters.put("user_id", userId);
  
          Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
          if (response.isError()) {
              throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
          }
          Element groupsElement = response.getPayload();
          NodeList groupNodes = groupsElement.getElementsByTagName("group");
          for (int i = 0; i < groupNodes.getLength(); i++) {
              Element groupElement = (Element) groupNodes.item(i);
              Group group = new Group();
              group.setId(groupElement.getAttribute("nsid"));
              group.setName(groupElement.getAttribute("name"));
              group.setAdmin("1".equals(groupElement.getAttribute("admin")));
              group.setEighteenPlus(groupElement.getAttribute("eighteenplus").equals("0") ? false : true);
              groups.add(group);
          }
          return groups;
      }
docs: Get a collection of public groups for the user.
  
  The groups will contain only the members nsid, name, admin and eighteenplus. If you want the whole group-information, you have to call
  {@link com.flickr4java.flickr.groups.GroupsInterface#getInfo(String)}.
  
  This method does not require authentication.
  
  @param userId
  The user ID
  @return The public groups
  @throws FlickrException