class Utilities {

    public static <T> T[] removeFromArray(T[] arr, Object obj)
    {
        int foundIndex = -1;
        for (int index = 0; index < arr.length; ++index)
        {
            if (arr[index] == null ? obj == null : arr[index].equals(obj))
            {
                foundIndex = index;
                break;
            }
        }
        T[] newArr;
        if (foundIndex >= 0)
        {
            newArr = Arrays.copyOf(arr, arr.length - 1);
            if (foundIndex < arr.length - 1)
            {
                System.arraycopy(arr, foundIndex + 1, newArr, foundIndex, arr.length - foundIndex - 1);
            }
        }
        else
        {
            newArr = arr;
        }
        return newArr;
    }

    private  Utilities();

}