1
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
Map<String, Object> returnMap = new HashMap<String, Object>();
    for (int i = 0; i < propertyDescriptors.length; i++) {
             ......
            returnMap.put(propertyName, result);

            }
Map<String, Object> returnMap = new HashMap<String, Object>();
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
    for (int i = 0; i < propertyDescriptors.length; i++) {
             ......
            returnMap.put(propertyName, result);

            }

ローカル変数を定義するとき、どの順序が良いですか? 最初のコードとして定義すると、propertyDescriptors の定義とその使用の間の距離が長くなりすぎますが、2 番目のコードとして定義すると、マップの定義またはマップの使用の間の距離が長くなります。

それで、それらを注文するルールはどれですか?

4

3 に答える 3