code: public BoxCollaboration.Info collaborate(BoxCollaborator collaborator, BoxCollaboration.Role role,
                                               Boolean notify, Boolean canViewPath) {
          JsonObject accessibleByField = new JsonObject();
          accessibleByField.add("id", collaborator.getID());
  
          if (collaborator instanceof BoxUser) {
              accessibleByField.add("type", "user");
          } else if (collaborator instanceof BoxGroup) {
              accessibleByField.add("type", "group");
          } else {
              throw new IllegalArgumentException("The given collaborator is of an unknown type.");
          }
  
          return this.collaborate(accessibleByField, role, notify, canViewPath);
      }
docs: Adds a collaborator to this folder.
  
  @param collaborator the collaborator to add.
  @param role         the role of the collaborator.
  @param notify       the user/group should receive email notification of the collaboration or not.
  @param canViewPath  the view path collaboration feature is enabled or not.
  View path collaborations allow the invitee to see the entire ancestral path to the associated
  folder. The user will not gain privileges in any ancestral folder.
  @return info about the new collaboration.