2727 */
2828
2929public final class ResourceString {
30- private List <String > notes ;
3130 private final String key ;
3231 private final String value ;
3332 private int sequenceNumber ;
33+ private List <String > notes ;
3434
35- public ResourceString (List <String > notes , String key , String value , int sequenceNumber ) {
36- this .notes = notes ;
35+ public ResourceString (String key , String value , int sequenceNumber , List <String > notes ) {
3736 this .key = key ;
3837 this .value = value ;
3938 this .sequenceNumber = sequenceNumber ;
39+ this .notes = notes == null ? null : new ArrayList <>(notes );
4040 }
4141
4242 public ResourceString (String key , String value , int sequenceNumber ) {
43- this (null , key , value , sequenceNumber );
43+ this (key , value , sequenceNumber , null );
4444 }
4545
4646 public ResourceString (String key , String value ) {
@@ -64,7 +64,7 @@ public List<String> getNotes() {
6464
6565 public void addNote (String note ) {
6666 if (notes == null ) {
67- notes = new ArrayList <String >();
67+ notes = new ArrayList <>();
6868 }
6969 notes .add (note );
7070 }
@@ -179,12 +179,7 @@ private static int compareNotes(List<String> n1, List<String> n2) {
179179 int index = 0 ;
180180 while (cmp == 0 && index < n1 .size ()) {
181181 String s1 = n1 .get (index );
182- String s2 ;
183- try {
184- s2 = n2 .get (index );
185- } catch (IndexOutOfBoundsException ex ) {
186- s2 = null ;
187- }
182+ String s2 = index < n2 .size () ? n2 .get (index ) : null ;
188183 cmp = compareStrings (s1 , s2 );
189184 index ++;
190185 }
0 commit comments