Skip to content

Commit b62c970

Browse files
johnmayegonw
authored andcommitted
Expected HashSet size
1 parent d3f5847 commit b62c970

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/UniqueAtomMatches.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424

2525
package org.openscience.cdk.isomorphism;
2626

27-
import com.google.common.collect.Sets;
28-
2927
import java.util.BitSet;
28+
import java.util.HashSet;
3029
import java.util.Set;
3130
import java.util.function.Predicate;
3231

@@ -56,7 +55,7 @@ final class UniqueAtomMatches implements Predicate<int[]> {
5655
* @param expectedHits expected number of unique matches
5756
*/
5857
private UniqueAtomMatches(int expectedHits) {
59-
this.unique = Sets.newHashSetWithExpectedSize(expectedHits);
58+
this.unique = new HashSet<>(2*expectedHits);
6059
}
6160

6261
/**

base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/UniqueBondMatches.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
package org.openscience.cdk.isomorphism;
2626

27-
import com.google.common.collect.Sets;
28-
2927
import java.util.HashSet;
3028
import java.util.Set;
3129
import java.util.function.Predicate;
@@ -59,7 +57,7 @@ final class UniqueBondMatches implements Predicate<int[]> {
5957
* @param expectedHits expected number of unique matches
6058
*/
6159
private UniqueBondMatches(int[][] g, int expectedHits) {
62-
this.unique = Sets.newHashSetWithExpectedSize(expectedHits);
60+
this.unique = new HashSet<>(2*expectedHits);
6361
this.g = g;
6462
}
6563

base/standard/src/main/java/org/openscience/cdk/aromaticity/Aromaticity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
package org.openscience.cdk.aromaticity;
2626

27-
import com.google.common.collect.Sets;
2827
import org.openscience.cdk.exception.CDKException;
2928
import org.openscience.cdk.graph.CycleFinder;
3029
import org.openscience.cdk.graph.Cycles;
@@ -35,6 +34,7 @@
3534
import org.openscience.cdk.ringsearch.RingSearch;
3635

3736
import java.util.Arrays;
37+
import java.util.HashSet;
3838
import java.util.Objects;
3939
import java.util.Set;
4040

@@ -186,7 +186,7 @@ public Set<IBond> findBonds(IAtomContainer molecule) throws CDKException {
186186
final RingSearch ringSearch = new RingSearch(molecule, graph);
187187
final int[] electrons = model.contribution(molecule, ringSearch);
188188

189-
final Set<IBond> bonds = Sets.newHashSetWithExpectedSize(molecule.getBondCount());
189+
final Set<IBond> bonds = new HashSet<>(2*molecule.getBondCount());
190190

191191
// obtain the subset of electron contributions which are >= 0 (i.e.
192192
// allowed to be aromatic) - we then find the cycles in this subgraph

legacy/src/main/java/org/openscience/cdk/smiles/smarts/SMARTSQueryTool.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package org.openscience.cdk.smiles.smarts;
2020

2121
import com.google.common.collect.FluentIterable;
22-
import com.google.common.collect.Sets;
2322
import com.google.common.primitives.Ints;
2423
import org.openscience.cdk.aromaticity.Aromaticity;
2524
import org.openscience.cdk.aromaticity.ElectronDonation;
@@ -43,6 +42,7 @@
4342

4443
import java.util.ArrayList;
4544
import java.util.BitSet;
45+
import java.util.HashSet;
4646
import java.util.LinkedHashMap;
4747
import java.util.List;
4848
import java.util.Map;
@@ -406,7 +406,7 @@ public List<List<Integer>> getMatchingAtoms() {
406406
*/
407407
public List<List<Integer>> getUniqueMatchingAtoms() {
408408
List<List<Integer>> matched = new ArrayList<List<Integer>>(mappings.size());
409-
Set<BitSet> atomSets = Sets.newHashSetWithExpectedSize(mappings.size());
409+
Set<BitSet> atomSets = new HashSet<>(2*mappings.size());
410410
for (int[] mapping : mappings) {
411411
BitSet atomSet = new BitSet();
412412
for (int x : mapping)

0 commit comments

Comments
 (0)