打开试用版需要多少费用

时间:2018-10-12 12:59:47

标签: java memory-management

我想知道这两种代码变体之间是否存在差异:

for (TIn element : collection) {
            try {
                result.add(converter.convert(element));
            } catch (Exception e) {
                throw new ConversionException(CONVERSION_ERROR_MESSAGE, e);
            }
        }

try {
            for (TIn element : collection) {
                result.add(converter.convert(element));
            } catch (Exception e) {
                throw new ConversionException(CONVERSION_ERROR_MESSAGE, e);
            }
        }

打开一次尝试是否消耗较少的资源,或者可以循环执行? 或者即使它们相等,哪种情况更可取?

0 个答案:

没有答案