class MimeTypeFilter {

    @NonNull
    public static String[] matchesMany(
            @Nullable String[] mimeTypes, @NonNull String filter) {
        if (mimeTypes == null) {
            return new String[] {};
        }

        final ArrayList<String> list = new ArrayList<>();
        final String[] filterParts = filter.split("/");
        for (String mimeType : mimeTypes) {
            final String[] mimeTypeParts = mimeType.split("/");
            if (mimeTypeAgainstFilter(mimeTypeParts, filterParts)) {
                list.add(mimeType);
            }
        }

        return list.toArray(new String[list.size()]);
    }

    private  MimeTypeFilter();

}