switch case String返回值

2020-09-23  本文已影响0人  Amy木婉清
 /**
     * 出库方式
     * 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();
上一篇 下一篇

猜你喜欢

热点阅读