class TvContractUtils {

    public static TvContentRating[] stringToContentRatings(String commaSeparatedRatings) {
        if (TextUtils.isEmpty(commaSeparatedRatings)) {
            return EMPTY;
        }
        String[] ratings = commaSeparatedRatings.split("\\s*,\\s*", -1);
        List<TvContentRating> contentRatings = new ArrayList<>(ratings.length);
        for (String rating : ratings) {
            try {
                contentRatings.add(TvContentRating.unflattenFromString(rating));
            } catch (IllegalArgumentException e) {
                Log.w(TAG, "Can't parse the content rating: '" + rating + "', skipping", e);
            }
        }
        return contentRatings.size() == 0 ? EMPTY
                : contentRatings.toArray(new TvContentRating[contentRatings.size()]);
    }

    private  TvContractUtils();

}