how to delete relation between friends?

How do i properly delete a relationship between two users?
Here was my method for deleting the relationship but it wont work because i keep getting a cast error
java.lang.Object[] cannot be cast to java.util.Map
Here is my code:
private void updateFriendList(BackendlessUser user1, BackendlessUser user2) {
ArrayList<BackendlessUser[]> friendsList = new ArrayList<>();
friendsList.add((BackendlessUser[]) user1.getProperty(“friends”));
friendsList.remove(user2);
user1.setProperty(“friends”,friendsList);
Backendless.Data.of(BackendlessUser.class).save(user1, new AsyncCallback<BackendlessUser>() {
@Override
public void handleResponse(BackendlessUser response) {
//Success!!
Toast.makeText(getActivity(),“Friend Deleted!”,Toast.LENGTH_LONG).show();
}
@Override
public void handleFault(BackendlessFault fault) {
}
});
}

Read the docs on this page:
https://backendless.com/documentation/users/android/users_user_properties.htm

Specifically the part starting with:

"There is a special consideration for a user property containing a collection of related data.."

Mark, How could i do this with arraylist? it seems that using the Arrays.asList is not working at all… Is the check to see if the size of the array is greater than zero necessary considering that the user needs friends in order to delete them? So wouldn’t that mean that the array could never have a length of zero in the first place?

The check to see if the size of the array is greater than zero necessary before you cast the object to an array of a specific type.

Ok but i can’t cast my arraylist to from an object array to a BackendlessUser array without ever getting some kind of error! I am now getting… incompatible types: ArrayList<Object[]> cannot be converted to BackendlessUser[]

This is the code that is causing the error. How can i change this to make it work. I believe i need to use an arraylist instead of an array to be able to remove a specific object by its name.
ArrayList<Object[]> friendsListObjects = new ArrayList<>();
ArrayList<BackendlessUser[]> friendsList = new ArrayList<>();
friendsListObjects.add((Object[]) user1.getProperty(“friends”));
if (friendsListObjects.size() > 0 && friendsListObjects != null) {
friendsList = (BackendlessUser[]) friendsListObjects;

The documentation shows how to do it. If you need help with your code, we’d be happy to do it, but the free support does not cover it.