Skip to content

Commit 5f2ddf1

Browse files
committed
Correct logic for box hashing.
1 parent 8992f8d commit 5f2ddf1

File tree

1 file changed

+4
-7
lines changed
  • descriptor/qsarmolecular/src/main/java/org/openscience/cdk/geometry/surface

1 file changed

+4
-7
lines changed

descriptor/qsarmolecular/src/main/java/org/openscience/cdk/geometry/surface/NeighborList.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,10 @@ public NeighborList(IAtom[] atoms, double radius) {
5151
this.boxSize = 2 * radius;
5252
for (int i = 0; i < atoms.length; i++) {
5353
String key = getKeyString(atoms[i]);
54-
if (this.boxes.containsKey(key)) {
55-
List<Integer> arl = this.boxes.get(key);
56-
arl.add(i);
57-
this.boxes.put(key, arl);
58-
} else {
59-
this.boxes.put(key, new ArrayList<Integer>());
60-
}
54+
List<Integer> arl = this.boxes.get(key);
55+
if (arl == null)
56+
this.boxes.put(key, arl = new ArrayList<>());
57+
arl.add(i);
6158
}
6259
}
6360

0 commit comments

Comments
 (0)