To remove an item from a collection, call the PUT endpoint for that specific
type of item and pass along a list of collection IDs that does not include the
ID of the collection that needs to be removed.
The only collection that is available via the API is the "Favorites"
collection and therefore to remove an item from this collection can be
achieved by passing the API an empty array of collections.
BoxFile file = new BoxFile(api, "id");
BoxFile.Info info = file.getInfo("collections");
ArrayList<BoxCollection> collections = new ArrayList<BoxCollection>();
for (BoxCollection.Info info : info.getCollections(api)) {
// Include every existing collection except for favorites to remove the file
// from the favorites collection.
if (!info.getCollectionType().equals("favorites")) {
collections.add(info.getResource());
}
}
file.setCollections(collections.toArray());