美文网首页
switch case String返回值

switch case String返回值

作者: Amy木婉清 | 来源:发表于2020-09-23 20:34 被阅读0次
 /**
     * 出库方式
     * 1紧急  2配发 3自取
     *
     */
    private String getExTypeName(int type) {
        String typeName = null;
        switch (type) {
            case 1:
                typeName=  mContext.getString(R.string.warehouse_type_urgent);
            break;
            case 2:
                typeName= mContext.getString(R.string.warehouse_type_allotment);
            break;
            case 3:
                typeName= mContext.getString(R.string.warehouse_type_invite);
            break;
        }
        return typeName;
    }

第二种

 /**
     * 出库方式
     * 1紧急  2配发 3自取
     *
     */
    private String getExTypeName(int type) {
        switch (type) {
            case 1:
              return mContext.getString(R.string.warehouse_type_urgent);

            case 2:
                return mContext.getString(R.string.warehouse_type_allotment);

            case 3:
                return mContext.getString(R.string.warehouse_type_invite);

        }
       return null;
    }

返回条目:

        return listBeans == null ? 0 : listBeans.size();

相关文章

网友评论

      本文标题:switch case String返回值

      本文链接:https://www.haomeiwen.com/subject/ecinyktx.html