Skip to content

Commit 90d3209

Browse files
johnmayegonw
authored andcommitted
Replace Lists usage - diamond brackets (1.7+) make thinks more concise than the old help function.
1 parent 0457dea commit 90d3209

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

base/core/src/main/java/org/openscience/cdk/graph/JumboPathGraph.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
*/
2424
package org.openscience.cdk.graph;
2525

26-
import com.google.common.collect.Lists;
2726

2827
import java.util.ArrayList;
2928
import java.util.BitSet;
@@ -89,7 +88,7 @@ final class JumboPathGraph extends PathGraph {
8988
if (limit < 3 || limit > ord) throw new IllegalArgumentException("limit should be from 3 to |V|");
9089

9190
for (int v = 0; v < ord; v++)
92-
graph[v] = Lists.newArrayList();
91+
graph[v] = new ArrayList<>();
9392

9493
// construct the path-graph
9594
for (int v = 0; v < ord; v++) {

base/core/src/main/java/org/openscience/cdk/graph/RegularPathGraph.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
*/
2424
package org.openscience.cdk.graph;
2525

26-
import com.google.common.collect.Lists;
2726

2827
import java.util.ArrayList;
2928
import java.util.Collections;
@@ -90,7 +89,7 @@ final class RegularPathGraph extends PathGraph {
9089
if (ord >= 64) throw new IllegalArgumentException("graph has 64 or more atoms, use JumboPathGraph");
9190

9291
for (int v = 0; v < ord; v++)
93-
graph[v] = Lists.newArrayList();
92+
graph[v] = new ArrayList<>();
9493

9594
// construct the path-graph
9695
for (int v = 0; v < ord; v++) {

base/test-core/src/test/java/org/openscience/cdk/graph/InitialCyclesTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@
2323
*/
2424
package org.openscience.cdk.graph;
2525

26-
import com.google.common.collect.Lists;
2726
import org.junit.Test;
2827

2928
import java.io.IOException;
29+
import java.util.ArrayList;
3030
import java.util.Iterator;
3131
import java.util.List;
3232

3333
import static org.hamcrest.CoreMatchers.hasItem;
3434
import static org.hamcrest.CoreMatchers.hasItems;
3535
import static org.hamcrest.CoreMatchers.is;
3636
import static org.hamcrest.CoreMatchers.sameInstance;
37-
import static org.junit.Assert.assertFalse;
3837
import static org.hamcrest.MatcherAssert.assertThat;
38+
import static org.junit.Assert.assertFalse;
3939
import static org.junit.Assert.assertTrue;
4040

4141
/**
@@ -137,7 +137,7 @@ public void lengths_naphthalene() throws IOException {
137137
@Test
138138
public void cycles_naphthalene() throws IOException {
139139
InitialCycles initial = new InitialCycles(naphthalene());
140-
List<InitialCycles.Cycle> cycles = Lists.newArrayList(initial.cycles());
140+
List<InitialCycles.Cycle> cycles = new ArrayList<>(initial.cycles());
141141
assertThat(cycles.size(), is(2));
142142
assertThat(cycles.get(0).path(), is(new int[]{5, 0, 1, 2, 3, 4, 5}));
143143
assertThat(cycles.get(1).path(), is(new int[]{5, 4, 7, 8, 9, 6, 5}));
@@ -151,7 +151,7 @@ public void lengths_anthracene() throws IOException {
151151
@Test
152152
public void cycles_anthracene() throws IOException {
153153
InitialCycles initial = new InitialCycles(anthracene());
154-
List<InitialCycles.Cycle> cycles = Lists.newArrayList(initial.cycles());
154+
List<InitialCycles.Cycle> cycles = new ArrayList<>(initial.cycles());
155155
assertThat(cycles.size(), is(3));
156156
assertThat(cycles.get(0).path(), is(new int[]{5, 0, 1, 2, 3, 4, 5}));
157157
assertThat(cycles.get(1).path(), is(new int[]{9, 6, 5, 4, 7, 8, 9}));
@@ -166,7 +166,7 @@ public void lengths_bicyclo() throws IOException {
166166
@Test
167167
public void cycles_bicyclo() throws IOException {
168168
InitialCycles initial = new InitialCycles(bicyclo());
169-
List<InitialCycles.Cycle> cycles = Lists.newArrayList(initial.cycles());
169+
List<InitialCycles.Cycle> cycles = new ArrayList<>(initial.cycles());
170170
assertThat(cycles.size(), is(3));
171171
assertThat(cycles.get(0).path(), is(new int[]{5, 0, 1, 2, 3, 4, 5}));
172172
assertThat(cycles.get(1).path(), is(new int[]{5, 0, 1, 2, 7, 6, 5}));
@@ -186,7 +186,7 @@ public void lengths_cyclophane() throws IOException {
186186
@Test
187187
public void cycles_cyclophane() throws IOException {
188188
InitialCycles initial = new InitialCycles(cyclophane_odd());
189-
List<InitialCycles.Cycle> cycles = Lists.newArrayList(initial.cycles());
189+
List<InitialCycles.Cycle> cycles = new ArrayList<>(initial.cycles());
190190
assertThat(cycles.size(), is(2));
191191
assertThat(cycles.get(0).path(), is(new int[]{3, 2, 1, 0, 5, 4, 3}));
192192
assertThat(cycles.get(1).path(), is(new int[]{3, 2, 1, 0, 10, 9, 8, 7, 6, 3}));
@@ -195,30 +195,30 @@ public void cycles_cyclophane() throws IOException {
195195
@Test
196196
public void cycles_cyclophane_odd_limit_5() throws IOException {
197197
InitialCycles initial = new InitialCycles(cyclophane_odd(), 5);
198-
List<InitialCycles.Cycle> cycles = Lists.newArrayList(initial.cycles());
198+
List<InitialCycles.Cycle> cycles = new ArrayList<>(initial.cycles());
199199
assertThat(cycles.size(), is(0));
200200
}
201201

202202
@Test
203203
public void cycles_cyclophane_odd_limit_6() throws IOException {
204204
InitialCycles initial = new InitialCycles(cyclophane_odd(), 6);
205-
List<InitialCycles.Cycle> cycles = Lists.newArrayList(initial.cycles());
205+
List<InitialCycles.Cycle> cycles = new ArrayList<>(initial.cycles());
206206
assertThat(cycles.size(), is(1));
207207
assertThat(cycles.get(0).path(), is(new int[]{3, 2, 1, 0, 5, 4, 3}));
208208
}
209209

210210
@Test
211211
public void cycles_cyclophane_odd_limit_7() throws IOException {
212212
InitialCycles initial = new InitialCycles(cyclophane_odd(), 7);
213-
List<InitialCycles.Cycle> cycles = Lists.newArrayList(initial.cycles());
213+
List<InitialCycles.Cycle> cycles = new ArrayList<>(initial.cycles());
214214
assertThat(cycles.size(), is(1));
215215
assertThat(cycles.get(0).path(), is(new int[]{3, 2, 1, 0, 5, 4, 3}));
216216
}
217217

218218
@Test
219219
public void cycles_family_odd() {
220220
InitialCycles initial = new InitialCycles(cyclophane_odd());
221-
List<InitialCycles.Cycle> cycles = Lists.newArrayList(initial.cycles());
221+
List<InitialCycles.Cycle> cycles = new ArrayList<>(initial.cycles());
222222
assertThat(cycles.get(1).path(), is(new int[]{3, 2, 1, 0, 10, 9, 8, 7, 6, 3}));
223223
int[][] family = cycles.get(1).family();
224224
assertThat(family.length, is(2));
@@ -229,7 +229,7 @@ public void cycles_family_odd() {
229229
@Test
230230
public void cycles_family_even() {
231231
InitialCycles initial = new InitialCycles(cyclophane_even());
232-
List<InitialCycles.Cycle> cycles = Lists.newArrayList(initial.cycles());
232+
List<InitialCycles.Cycle> cycles = new ArrayList<>(initial.cycles());
233233
assertThat(cycles.get(1).path(), is(new int[]{3, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3}));
234234
int[][] family = cycles.get(1).family();
235235
assertThat(family.length, is(2));

0 commit comments

Comments
 (0)