Add myFriends - mandatory with ManyToMany

@param Collection
@return User
973427
public function addMyFriends(Collection $users)
    {
        foreach ($users as $user) {
            $this->addMyFriend($user);
        }

        return $this;
    }
762157
@Override
    public <U extends ApiBaseUser> Response exclude(Collection<U> users) {
    	for(U user : users)
    		this.usernames.remove(user.getName());
    	return this;
    }
234983
def _get_collection_for_user(self, collection_id, user):
        """"""
        collection_query = Collection.objects.filter(pk=collection_id)
        if not collection_query.exists():
            raise exceptions.ValidationError('Collection id does not exist')

        collection = collection_query.first()
        if not user.has_perm('add_collection', obj=collection):
            if user.is_authenticated:
                raise exceptions.PermissionDenied()
            else:
                raise exceptions.NotFound()

        return collection
1330388
public function attach(Collection $collection, $type = 'myGedung\Support\Collection')
    {
        if ( ! is_null($type) && $collection instanceof $type) {
            if ( ! $this->find($collection->id)) {
                $this->put($collection->id, $collection);
            }
        }

        return $this;
    }
777414
public function addFriendship(DataObject $member, DataObject $followed) {
		if (!$member || !$followed) {
			throw new PermissionDeniedException('Read', 'Cannot read those users');
		}

		if ($member->ID != $this->securityContext->getMember()->ID) {
			throw new PermissionDeniedException('Write', 'Cannot create a friendship for that user');
		}

		$existing = Friendship::get()->filter(array(
			'InitiatorID'		=> $member->ID,
			'OtherID'			=> $followed->ID,
		))->first();

		if ($existing) {
			return $existing;
		}
		
		// otherwise, we have a new one!
		$friendship = new Friendship;
		$friendship->InitiatorID = $member->ID;
		$friendship->OtherID = $followed->ID;
		
		// we add the initiator into the 
		
		// lets see if we have the reciprocal; if so, we can mark these as verified 
		$reciprocal = $friendship->reciprocal();

		// so we definitely add the 'member' to the 'followers' group of $followed
		$followers = $followed->getGroupFor(MicroBlogMember::FOLLOWERS);
		$followers->Members()->add($member);

		if ($reciprocal) {
			$reciprocal->Status = 'Approved';
			$reciprocal->write();
			
			$friendship->Status = 'Approved';
			
			// add to each other's friends groups
			$friends = $followed->getGroupFor(MicroBlogMember::FRIENDS);
			$friends->Members()->add($member);
			
			
			$friends = $member->getGroupFor(MicroBlogMember::FRIENDS);
			$friends->Members()->add($followed);
		}

		$friendship->write();
		return $friendship;
	}
887970
public function add(iterable $elements): CollectionInterface
    {
        foreach ($elements as $key => $element) {
            $this->set($key, $element);
        }

        return $this;
    }
1119831
public function removeMyFriends(Collection $users)
    {
        foreach ($users as $user) {
            $this->removeMyFriend($user);
        }

        return $this;
    }
70061
public static <T> Collection<T> addAll(Collection<T> collection, Object value) {
		return addAll(collection, value, TypeUtil.getTypeArgument(collection.getClass()));
	}
1175260
public ResponseWrapper addFriends(String username, String... users)
            throws APIConnectionException, APIRequestException {
        StringUtils.checkUsername(username);
        Preconditions.checkArgument(null != users && users.length > 0, "friend list should not be empty");

        JsonArray array = new JsonArray();
        for (String user : users) {
            array.add(new JsonPrimitive(user));
        }

        return _httpClient.sendPost(_baseUrl + userPath + "/" + username + "/friends", array.toString());
    }
300548
public function addCollection(self $collection)
    {
        // we need to remove all routes with the same names first because just replacing them
        // would not place the new route at the end of the merged array
        foreach ($collection->all() as $name => $route) {
            unset($this->routes[$name]);
            $this->routes[$name] = $route;
        }

        foreach ($collection->getResources() as $resource) {
            $this->addResource($resource);
        }
    }
741329
public List<Friend> getFriends() {
		return getFriends(new Filter<Friend>() {

			public boolean accept(Friend e) {
				return true;
			}
		});
	}
37614
public boolean addAll(Collection otherCollection,
                          Transaction transaction)
                    throws ObjectManagerException
    {
        boolean modified = false;
        try {
            for (Iterator iterator = otherCollection.iterator();;)
                modified = add((Token) iterator.next(transaction), transaction);
        } catch (java.util.NoSuchElementException exception) {
            // No FFDC code needed.
            // We have run off the end of the other collection.
        } // try.   
        return modified;
    }
1305510
def add_user(self, **kwargs):
        """"""
        user = self.UserClass(**kwargs)
        if hasattr(user, 'active'):
            user.active = True
        self.db_adapter.add_object(user)
        return user
1345818
public void linkOneToMany(Object obj, CollectionDescriptor cod, boolean insert)
    {
        Object referencedObjects = cod.getPersistentField().get(obj);
        storeAndLinkOneToMany(true, obj, cod,referencedObjects, insert);
    }
1014031
public static <T> Collection<T> addAll(Collection<T> collection, Iterator<T> iterator) {
		if (null != collection && null != iterator) {
			while (iterator.hasNext()) {
				collection.add(iterator.next());
			}
		}
		return collection;
	}
496208
public function fillCollectionWithRelations(CollectionInterface $collection)
    {
        if (!$collection->count()) {
            return $collection;
        }

        foreach ($this->getWith() as $relation) {
            $relation->fillCollection($collection);
        }

        return $collection;
    }
1245104
public FriendGroup getFriendGroupByName(String name) {
		final RosterGroup g = connection.getRoster().getGroup(name);
		if (g != null) {
			return new FriendGroup(this, connection, g);
		}
		return addFriendGroup(name);
	}