Skip to content

Commit d3045ca

Browse files
authored
Chore: replace explicit type with <> (#142)
Thanks. FYI, AndBible is limited to Java 7 and part of Java 8. If we introduce Java 8 features we need to check that it doesn't break AndBible.
1 parent d0a11e6 commit d3045ca

File tree

82 files changed

+182
-182
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+182
-182
lines changed

src/main/java/org/crosswire/common/activate/Activator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static void deactivateAll() {
8787
/**
8888
* The list of things that we have activated
8989
*/
90-
private static Set<Activatable> activated = new HashSet<Activatable>();
90+
private static Set<Activatable> activated = new HashSet<>();
9191

9292
/**
9393
* The object we use to prevent others from

src/main/java/org/crosswire/common/config/ChoiceFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static Map<String, Object> getDataMap() {
8484
/**
8585
* Storage of various registered objects
8686
*/
87-
private static Map<String, Object> datamap = new HashMap<String, Object>();
87+
private static Map<String, Object> datamap = new HashMap<>();
8888

8989
/**
9090
* Store of the known ChoiceTypes

src/main/java/org/crosswire/common/config/Config.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ public class Config implements Iterable<Choice> {
8686
*/
8787
public Config(String title) {
8888
this.title = title;
89-
keys = new ArrayList<String>();
90-
models = new ArrayList<Choice>();
89+
keys = new ArrayList<>();
90+
models = new ArrayList<>();
9191
local = new PropertyMap();
92-
listeners = new CopyOnWriteArrayList<ConfigListener>();
92+
listeners = new CopyOnWriteArrayList<>();
9393
}
9494

9595
/**
@@ -492,12 +492,12 @@ protected void fireChoiceRemoved(String key, Choice model) {
492492
/**
493493
* The array that stores the keys
494494
*/
495-
protected List<String> keys = new ArrayList<String>();
495+
protected List<String> keys = new ArrayList<>();
496496

497497
/**
498498
* The array that stores the models
499499
*/
500-
protected List<Choice> models = new ArrayList<Choice>();
500+
protected List<Choice> models = new ArrayList<>();
501501

502502
/**
503503
* The set of local values

src/main/java/org/crosswire/common/config/IntOptionsChoice.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void init(Element option, ResourceBundle configResources) throws StartupE
4747

4848
String prefix = getKey() + ".alternative.";
4949

50-
options = new TreeMap<Integer, String>();
50+
options = new TreeMap<>();
5151
Iterator<Element> iter = option.getChildren("alternative").iterator();
5252
while (iter.hasNext()) {
5353
Element alternative = iter.next();
@@ -63,7 +63,7 @@ public void init(Element option, ResourceBundle configResources) throws StartupE
6363
* @see org.crosswire.common.config.MappedChoice#getOptions()
6464
*/
6565
public Map<Integer, String> getOptions() {
66-
return new TreeMap<Integer, String>(options);
66+
return new TreeMap<>(options);
6767
}
6868

6969
/*

src/main/java/org/crosswire/common/config/MappedOptionsChoice.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void init(Element option, ResourceBundle configResources) throws StartupE
5757
if (map instanceof Map<?, ?>) {
5858
options = (Map<?, ?>) map;
5959
} else {
60-
options = new TreeMap<Object, Object>();
60+
options = new TreeMap<>();
6161
}
6262
}
6363

@@ -67,7 +67,7 @@ public void init(Element option, ResourceBundle configResources) throws StartupE
6767
* @see org.crosswire.common.config.MappedChoice#getOptions()
6868
*/
6969
public Map<Object, Object> getOptions() {
70-
return new TreeMap<Object, Object>(options);
70+
return new TreeMap<>(options);
7171
}
7272

7373
/*

src/main/java/org/crosswire/common/diff/Bitap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public Bitap(String text, String pattern, int loc) {
4747
this.text = text;
4848
this.pattern = pattern;
4949
this.loc = loc;
50-
alphabet = new HashMap<Character, Integer>();
50+
alphabet = new HashMap<>();
5151
}
5252

5353
/*

src/main/java/org/crosswire/common/diff/Diff.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public List<Difference> compare() {
7676
// Check for equality (speedup)
7777
List<Difference> diffs;
7878
if (source.equals(target)) {
79-
diffs = new ArrayList<Difference>();
79+
diffs = new ArrayList<>();
8080
diffs.add(new Difference(EditType.EQUAL, source));
8181
return diffs;
8282
}
@@ -116,7 +116,7 @@ public List<Difference> compare() {
116116
* @return List of Difference objects
117117
*/
118118
private List<Difference> compute() {
119-
List<Difference> diffs = new ArrayList<Difference>();
119+
List<Difference> diffs = new ArrayList<>();
120120

121121
if ("".equals(source)) {
122122
// Just add some text (speedup)
@@ -173,7 +173,7 @@ private List<Difference> compute() {
173173

174174
if (diffs == null) {
175175
// No acceptable result.
176-
diffs = new ArrayList<Difference>();
176+
diffs = new ArrayList<>();
177177
diffs.add(new Difference(EditType.DELETE, source));
178178
diffs.add(new Difference(EditType.INSERT, target));
179179
}

src/main/java/org/crosswire/common/diff/DiffCleanup.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private DiffCleanup() {
4848
*/
4949
public static void cleanupSemantic(final List<Difference> diffs) {
5050
boolean changes = false;
51-
Stack<Difference> equalities = new Stack<Difference>(); // Stack of indices where equalities are
51+
Stack<Difference> equalities = new Stack<>(); // Stack of indices where equalities are
5252
// found.
5353
String lastEquality = null; // Always equal to
5454
// equalities.lastElement().getText()
@@ -130,7 +130,7 @@ public static void cleanupEfficiency(final List<Difference> diffs) {
130130
}
131131

132132
boolean changes = false;
133-
Stack<Difference> equalities = new Stack<Difference>(); // Stack of indices where equalities are
133+
Stack<Difference> equalities = new Stack<>(); // Stack of indices where equalities are
134134
// found.
135135
String lastEquality = null; // Always equal to
136136
// equalities.lastElement().getText();

src/main/java/org/crosswire/common/diff/DifferenceEngine.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ public DifferenceEngine(final String source, final String target) {
6969
public List<Difference> generate() {
7070
long msEnd = System.currentTimeMillis() + (long) (timeout * 1000);
7171
int maxD = (this.sourceLength + this.targetLength) / 2;
72-
List<Set<String>> vMap1 = new ArrayList<Set<String>>();
73-
List<Set<String>> vMap2 = new ArrayList<Set<String>>();
74-
Map<Integer, Integer> v1 = new HashMap<Integer, Integer>();
75-
Map<Integer, Integer> v2 = new HashMap<Integer, Integer>();
72+
List<Set<String>> vMap1 = new ArrayList<>();
73+
List<Set<String>> vMap2 = new ArrayList<>();
74+
Map<Integer, Integer> v1 = new HashMap<>();
75+
Map<Integer, Integer> v2 = new HashMap<>();
7676
v1.put(Integer.valueOf(1), Integer.valueOf(0));
7777
v2.put(Integer.valueOf(1), Integer.valueOf(0));
7878
int x;
7979
int y;
8080
String footstep; // Used to track overlapping paths.
81-
Map<String, Integer> footsteps = new HashMap<String, Integer>();
81+
Map<String, Integer> footsteps = new HashMap<>();
8282
boolean done = false;
8383
// If the total number of characters is odd, then the front path will
8484
// collide with the reverse path.
@@ -90,7 +90,7 @@ public List<Difference> generate() {
9090
}
9191

9292
// Walk the front path one step.
93-
vMap1.add(new HashSet<String>()); // Adds at index 'd'.
93+
vMap1.add(new HashSet<>()); // Adds at index 'd'.
9494
for (int k = -d; k <= d; k += 2) {
9595
Integer kPlus1Key = Integer.valueOf(k + 1);
9696
Integer kPlus1Value = v1.get(kPlus1Key);
@@ -134,7 +134,7 @@ public List<Difference> generate() {
134134
}
135135

136136
// Walk the reverse path one step.
137-
vMap2.add(new HashSet<String>()); // Adds at index 'd'.
137+
vMap2.add(new HashSet<>()); // Adds at index 'd'.
138138
for (int k = -d; k <= d; k += 2) {
139139
Integer kPlus1Key = Integer.valueOf(k + 1);
140140
Integer kPlus1Value = v2.get(kPlus1Key);
@@ -195,7 +195,7 @@ public List<Difference> generate() {
195195
* @return List of Difference objects
196196
*/
197197
protected List<Difference> path1(final List<Set<String>> vMap, final String newSource, final String newTarget) {
198-
List<Difference> path = new ArrayList<Difference>();
198+
List<Difference> path = new ArrayList<>();
199199
int x = newSource.length();
200200
int y = newTarget.length();
201201
EditType lastEditType = null;
@@ -251,7 +251,7 @@ protected List<Difference> path1(final List<Set<String>> vMap, final String newS
251251
* @return List of Difference objects
252252
*/
253253
protected List<Difference> path2(final List<Set<String>> vMap, final String newSource, final String newTarget) {
254-
List<Difference> path = new ArrayList<Difference>();
254+
List<Difference> path = new ArrayList<>();
255255

256256
//cached versions of length from immutable strings
257257
final int cachedNewSourceLength = newSource.length();

src/main/java/org/crosswire/common/diff/LineMap.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ public LineMap(final String source, final String target) {
4949

5050
// "\x00" is a valid character, but various debuggers don't like it.
5151
// So we'll insert a junk entry to avoid generating a null character.
52-
lines = new ArrayList<String>();
52+
lines = new ArrayList<>();
5353
lines.add("");
5454

55-
Map<String, Integer> linehash = new HashMap<String, Integer>();
55+
Map<String, Integer> linehash = new HashMap<>();
5656
sourceMap = linesToCharsMunge(source, lines, linehash);
5757
targetMap = linesToCharsMunge(target, lines, linehash);
5858
}

0 commit comments

Comments
 (0)