function tf = isgroupmethod(methods_)
%MATLAB Code Generation Library Function
% ISGROUPMETHOD Determine if methods is a valid method specification


%   Copyright 2021-2023 The MathWorks, Inc.
%#codegen

if isstring(methods_)
    methods = {char(methods_)}; % Equivalent to cellstr for codegen
elseif ~iscell(methods_)
    methods = {methods_};
else
    methods = methods_;
end

if isempty(methods)
    tf = false;
elseif isa(methods{1},'function_handle')
    tf = true;
elseif ischar(methods{1}) && isrow(methods{1})
    coder.internal.assert(coder.internal.isConst(methods),'MATLAB:groupsummary:CodegenConstMethod');
    isValidMethodName = coder.const(feval('startsWith',{'all', 'mean', 'sum', 'min', 'max', 'range', ...
        'median', 'mode', 'var', 'std', 'nummissing', 'nnz', 'numunique'},char(methods{1}),'IgnoreCase',true));
    tf = coder.const(feval('any',isValidMethodName));
else
    tf = false;
end