Skip to content

Commit 1ec9e12

Browse files
committed
Style fixes per Yoshito
1 parent 33f2bba commit 1ec9e12

2 files changed

Lines changed: 9 additions & 14 deletions

File tree

gp-res-filter/src/main/java/com/ibm/g11n/pipeline/resfilter/Bundle.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ public Bundle(Collection<ResourceString> resStrings, List<String> notes) {
3535
this.resStrings = new LinkedList<ResourceString>(resStrings);
3636
}
3737
if (notes != null) {
38-
this.notes = new ArrayList<String>(notes);
38+
this.notes = new ArrayList<>(notes);
3939
}
4040
}
4141

4242
public void addResourceString(ResourceString resString) {
4343
if (resStrings == null) {
44-
resStrings = new LinkedList<ResourceString>();
44+
resStrings = new LinkedList<>();
4545
}
4646
resStrings.add(resString);
4747
}
@@ -52,7 +52,7 @@ public void addResourceString(String key, String value, int sequenceNumber) {
5252

5353
public void addNote(String note) {
5454
if (notes == null) {
55-
notes = new ArrayList<String>();
55+
notes = new ArrayList<>();
5656
}
5757
notes.add(note);
5858
}

gp-res-filter/src/main/java/com/ibm/g11n/pipeline/resfilter/ResourceString.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@
2727
*/
2828

2929
public 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

Comments
 (0)