diff --git a/src/main/java/com/imsweb/algorithms/StateCountyInputDto.java b/src/main/java/com/imsweb/algorithms/StateCountyInputDto.java index 1e87ca3..e1bf554 100644 --- a/src/main/java/com/imsweb/algorithms/StateCountyInputDto.java +++ b/src/main/java/com/imsweb/algorithms/StateCountyInputDto.java @@ -5,25 +5,26 @@ import java.util.Arrays; import java.util.HashMap; -import java.util.List; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import org.apache.commons.lang3.math.NumberUtils; public class StateCountyInputDto { //Valid NAACCR values for state at dx - private static final List _VALID_STATES = Arrays.asList("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", + private static final Set _VALID_STATES = new HashSet<>(Arrays.asList("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY", "AS", "GU", "MP", "PW", "PR", "UM", "VI", "FM", "MH", "TT", "AB", "BC", "MB", "NB", "NL", "NS", "NT", "NU", "ON", "PE", - "QC", "SK", "YT", "AA", "AE", "AP"); + "QC", "SK", "YT", "AA", "AE", "AP")); //NAACCR values for missing or unknown state at dx - private static final List _MISSING_OR_UNKNOWN_STATES = Arrays.asList("", "CD", "US", "XX", "YY", "ZZ"); + private static final Set _MISSING_OR_UNKNOWN_STATES = new HashSet<>(Arrays.asList("", "CD", "US", "XX", "YY", "ZZ")); //NAACCR values for missing or unknown county at dx - private static final List _MISSING_OR_UNKNOWN_COUNTIES = Arrays.asList("", "999"); + private static final Set _MISSING_OR_UNKNOWN_COUNTIES = new HashSet<>(Arrays.asList("", "999")); // SEER City recodes private static final Map _SEER_CITY_RECODES = new HashMap<>(); diff --git a/src/main/java/com/imsweb/algorithms/StateCountyTractInputDto.java b/src/main/java/com/imsweb/algorithms/StateCountyTractInputDto.java index 1243f66..93c0649 100644 --- a/src/main/java/com/imsweb/algorithms/StateCountyTractInputDto.java +++ b/src/main/java/com/imsweb/algorithms/StateCountyTractInputDto.java @@ -4,7 +4,8 @@ package com.imsweb.algorithms; import java.util.Arrays; -import java.util.List; +import java.util.HashSet; +import java.util.Set; import org.apache.commons.lang3.math.NumberUtils; @@ -15,7 +16,7 @@ public enum CensusTract { } //NAACCR values for missing or unknown census tract - private static final List _MISSING_OR_UNKNOWN_CENSUS_TRACTS = Arrays.asList("", "000000", "999999"); + private static final Set _MISSING_OR_UNKNOWN_CENSUS_TRACTS = new HashSet<>(Arrays.asList("", "000000", "999999")); private String _censusTract2000; private String _censusTract2010; diff --git a/src/main/java/com/imsweb/algorithms/countyatdiagnosisanalysis/CountyAtDxAnalysisUtils.java b/src/main/java/com/imsweb/algorithms/countyatdiagnosisanalysis/CountyAtDxAnalysisUtils.java index 35796ea..8b82803 100644 --- a/src/main/java/com/imsweb/algorithms/countyatdiagnosisanalysis/CountyAtDxAnalysisUtils.java +++ b/src/main/java/com/imsweb/algorithms/countyatdiagnosisanalysis/CountyAtDxAnalysisUtils.java @@ -5,8 +5,9 @@ import java.util.Arrays; import java.util.HashMap; -import java.util.List; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import org.apache.commons.lang3.StringUtils; @@ -38,7 +39,7 @@ public final class CountyAtDxAnalysisUtils { public static final String OTHER_STATE_OR_DX_YEAR_BLANK = "10"; public static final String OTHER_REP_AND_GEO_BLANK = "10.1"; - private static final List _CANADIAN_STATE_ABBREVIATIONS = Arrays.asList("AB", "BC", "MB", "NB", "NL", "NS", "NT", "NU", "ON", "PE", "QC", "SK", "YT"); + private static final Set _CANADIAN_STATE_ABBREVIATIONS = new HashSet<>(Arrays.asList("AB", "BC", "MB", "NB", "NL", "NS", "NT", "NU", "ON", "PE", "QC", "SK", "YT")); private CountyAtDxAnalysisUtils() { // no instances of this class allowed! @@ -115,11 +116,11 @@ else if (!isBlankOrNineFilled(geocoderCertainty) && isBlankOrNineFilled(input.ge output.setCountyAtDxAnalysis(geocoderCountyAtDx); output.setCountyAtDxAnalysisFlag(GEO_CERT_KNOWN_REP_UNK); } - else if (Arrays.asList("1", "6").contains(geocoderCertainty)) { + else if ("1".equals(geocoderCertainty) || "6".equals(geocoderCertainty)) { output.setCountyAtDxAnalysis(geocoderCountyAtDx); output.setCountyAtDxAnalysisFlag(GEO_CERT_1_OR_6); } - else if (Arrays.asList("2", "3", "4").contains(geocoderCertainty)) { + else if ("2".equals(geocoderCertainty) || "3".equals(geocoderCertainty) || "4".equals(geocoderCertainty)) { output.setCountyAtDxAnalysis(input.getCountyAtDx()); output.setCountyAtDxAnalysisFlag(REP_CERT_2_3_OR_4); } diff --git a/src/main/java/com/imsweb/algorithms/derivedgrade/DerivedSummaryGradeUtils.java b/src/main/java/com/imsweb/algorithms/derivedgrade/DerivedSummaryGradeUtils.java index 174ecb6..f1640b7 100644 --- a/src/main/java/com/imsweb/algorithms/derivedgrade/DerivedSummaryGradeUtils.java +++ b/src/main/java/com/imsweb/algorithms/derivedgrade/DerivedSummaryGradeUtils.java @@ -3,6 +3,10 @@ */ package com.imsweb.algorithms.derivedgrade; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + import org.apache.commons.lang3.ArrayUtils; public final class DerivedSummaryGradeUtils { @@ -15,12 +19,12 @@ public final class DerivedSummaryGradeUtils { private static final String _BREAST_SCHEMA = "00480"; - private static final String[] _SPECIAL_SCHEMAS = new String[] {"00790", "00795", "00811", "00812", "00821", "00822", "00830"}; + private static final Set _SPECIAL_SCHEMAS = new HashSet<>(Arrays.asList("00790", "00795", "00811", "00812", "00821", "00822", "00830")); - private static final String[] _PRIO_BREAST_IN_SITU = new String[] {"H", "M", "L", "3", "2", "1", "D", "C", "B", "A", "9", null}; - private static final String[] _PRIO_BREAST_MALIGNANT = new String[] {"3", "2", "1", "H", "M", "L", "D", "C", "B", "A", "9", null}; - private static final String[] _PRIO_SPECIAL = new String[] {"8", null}; - private static final String[] _PRIO_OTHER = new String[] {"S", "5", "4", "3", "2", "1", "E", "D", "C", "B", "A", "H", "M", "L", "9", null}; + private static final String[] _PRIORITY_BREAST_IN_SITU = new String[] {"H", "M", "L", "3", "2", "1", "D", "C", "B", "A", "9", null}; + private static final String[] _PRIORITY_BREAST_MALIGNANT = new String[] {"3", "2", "1", "H", "M", "L", "D", "C", "B", "A", "9", null}; + private static final String[] _PRIORITY_SPECIAL = new String[] {"8", null}; + private static final String[] _PRIORITY_OTHER = new String[] {"S", "5", "4", "3", "2", "1", "E", "D", "C", "B", "A", "H", "M", "L", "9", null}; private DerivedSummaryGradeUtils() { // no instances of this class allowed! @@ -30,14 +34,14 @@ public static String deriveSummaryGrade(String schemaId, String behavior, String String[] priorities = null; if (_BREAST_SCHEMA.equals(schemaId)) { if ("2".equals(behavior)) - priorities = _PRIO_BREAST_IN_SITU; + priorities = _PRIORITY_BREAST_IN_SITU; else if ("3".equals(behavior)) - priorities = _PRIO_BREAST_MALIGNANT; + priorities = _PRIORITY_BREAST_MALIGNANT; } - else if (ArrayUtils.contains(_SPECIAL_SCHEMAS, schemaId)) - priorities = _PRIO_SPECIAL; + else if (_SPECIAL_SCHEMAS.contains(schemaId)) + priorities = _PRIORITY_SPECIAL; else - priorities = _PRIO_OTHER; + priorities = _PRIORITY_OTHER; if (priorities != null) { diff --git a/src/main/java/com/imsweb/algorithms/iarc/IarcUtils.java b/src/main/java/com/imsweb/algorithms/iarc/IarcUtils.java index 33c8025..cf03f9c 100644 --- a/src/main/java/com/imsweb/algorithms/iarc/IarcUtils.java +++ b/src/main/java/com/imsweb/algorithms/iarc/IarcUtils.java @@ -6,9 +6,12 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashSet; import java.util.List; +import java.util.Set; import org.apache.commons.lang3.math.NumberUtils; +import org.apache.commons.lang3.tuple.Pair; import com.imsweb.algorithms.internal.Utils; @@ -26,6 +29,37 @@ public final class IarcUtils { public static final Integer PRIMARY = 1; public static final Integer INSITU = 9; + private static final Set _SITE_GROUP_C02 = new HashSet<>(Arrays.asList("C01", "C02")); + private static final Set _SITE_GROUP_C06 = new HashSet<>(Arrays.asList("C00", "C03", "C04", "C05", "C06")); + private static final Set _SITE_GROUP_C14 = new HashSet<>(Arrays.asList("C09", "C10", "C12", "C13", "C14")); + private static final Set _SITE_GROUP_C20 = new HashSet<>(Arrays.asList("C19", "C20")); + private static final Set _SITE_GROUP_C24 = new HashSet<>(Arrays.asList("C23", "C24")); + private static final Set _SITE_GROUP_C34 = new HashSet<>(Arrays.asList("C33", "C34")); + private static final Set _SITE_GROUP_C41 = new HashSet<>(Arrays.asList("C40", "C41")); + private static final Set _SITE_GROUP_C68 = new HashSet<>(Arrays.asList("C65", "C66", "C67", "C68")); + + private static final List, Integer>> _HISTOLOGY_RANGES = new ArrayList<>(); + + static { + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("8051-8084,8120-8131"), 1)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("8090-8110"), 2)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("8140-8149,8160-8162,8190-8221,8260-8337,8350-8551,8570-8576,8940-8941"), 3)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("8030-8046,8150-8157,8170-8180,8230-8255,8340-8347,8560-8562,8580-8671"), 4)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("8010-8015,8020-8022,8050"), 5)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("8680-8713,8800-8921,8990-8991,9040-9044,9120-9125,9130-9136,9141-9252,9370-9373,9540-9582"), 6)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("9050-9055"), 7)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("9840,9861-9931,9945-9946,9950,9961-9964,9980-9987,9991-9992"), 8)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("9597,9670-9699,9712,9728,9731-9738,9761-9767,9769,9811-9818,9823-9826,9833,9836,9940"), 9)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("9700-9726,9729,9768,9827-9831,9834,9837,9948"), 10)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("9650-9667"), 11)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("9740-9742"), 12)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("9750-9759"), 13)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("9590-9591,9596,9727,9760,9800-9809,9820,9832,9835,9860,9960,9965-9975,9989"), 14)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("9140"), 15)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("8720-8790,8930-8936,8950-8983,9000-9030,9060-9110,9260-9365,9380-9539"), 16)); + _HISTOLOGY_RANGES.add(Pair.of(Utils.expandHistologiesAsIntegers("8000-8005"), 17)); + } + private IarcUtils() { // utility class } @@ -112,21 +146,21 @@ private static String calculateSiteGroup(String site) { String siteGroup = site != null && site.length() >= 3 ? site.toUpperCase().substring(0, 3) : null; if (siteGroup != null) { - if (Arrays.asList("C01", "C02").contains(siteGroup)) + if (_SITE_GROUP_C02.contains(siteGroup)) siteGroup = "C02"; - else if (Arrays.asList("C00", "C03", "C04", "C05", "C06").contains(siteGroup)) + else if (_SITE_GROUP_C06.contains(siteGroup)) siteGroup = "C06"; - else if (Arrays.asList("C09", "C10", "C12", "C13", "C14").contains(siteGroup)) + else if (_SITE_GROUP_C14.contains(siteGroup)) siteGroup = "C14"; - else if (Arrays.asList("C19", "C20").contains(siteGroup)) + else if (_SITE_GROUP_C20.contains(siteGroup)) siteGroup = "C20"; - else if (Arrays.asList("C23", "C24").contains(siteGroup)) + else if (_SITE_GROUP_C24.contains(siteGroup)) siteGroup = "C24"; - else if (Arrays.asList("C33", "C34").contains(siteGroup)) + else if (_SITE_GROUP_C34.contains(siteGroup)) siteGroup = "C34"; - else if (Arrays.asList("C40", "C41").contains(siteGroup)) + else if (_SITE_GROUP_C41.contains(siteGroup)) siteGroup = "C41"; - else if (Arrays.asList("C65", "C66", "C67", "C68").contains(siteGroup)) + else if (_SITE_GROUP_C68.contains(siteGroup)) siteGroup = "C68"; } @@ -138,41 +172,12 @@ private static Integer calculateHistGroup(String histology) { if (NumberUtils.isDigits(histology)) { int hist = NumberUtils.toInt(histology); - - if (Utils.isHistologyContained("8051-8084,8120-8131", hist)) - histologyGroup = 1; - else if (Utils.isHistologyContained("8090-8110", hist)) - histologyGroup = 2; - else if (Utils.isHistologyContained("8140-8149,8160-8162,8190-8221,8260-8337,8350-8551,8570-8576,8940-8941", hist)) - histologyGroup = 3; - else if (Utils.isHistologyContained("8030-8046,8150-8157,8170-8180,8230-8255,8340-8347,8560-8562,8580-8671", hist)) - histologyGroup = 4; - else if (Utils.isHistologyContained("8010-8015,8020-8022,8050", hist)) - histologyGroup = 5; - else if (Utils.isHistologyContained("8680-8713,8800-8921,8990-8991,9040-9044,9120-9125,9130-9136,9141-9252,9370-9373,9540-9582", hist)) - histologyGroup = 6; - else if (Utils.isHistologyContained("9050-9055", hist)) - histologyGroup = 7; - else if (Utils.isHistologyContained("9840,9861-9931,9945-9946,9950,9961-9964,9980-9987,9991-9992", hist)) - histologyGroup = 8; - else if (Utils.isHistologyContained("9597,9670-9699,9712,9728,9731-9738,9761-9767,9769,9811-9818,9823-9826,9833,9836,9940", hist)) - histologyGroup = 9; - else if (Utils.isHistologyContained("9700-9726,9729,9768,9827-9831,9834,9837,9948", hist)) - histologyGroup = 10; - else if (Utils.isHistologyContained("9650-9667", hist)) - histologyGroup = 11; - else if (Utils.isHistologyContained("9740-9742", hist)) - histologyGroup = 12; - else if (Utils.isHistologyContained("9750-9759", hist)) - histologyGroup = 13; - else if (Utils.isHistologyContained("9590-9591,9596,9727,9760,9800-9809,9820,9832,9835,9860,9960,9965-9975,9989", hist)) - histologyGroup = 14; - else if (hist == 9140) - histologyGroup = 15; - else if (Utils.isHistologyContained("8720-8790,8930-8936,8950-8983,9000-9030,9060-9110,9260-9365,9380-9539", hist)) - histologyGroup = 16; - else if (Utils.isHistologyContained("8000-8005", hist)) - histologyGroup = 17; + for (Pair, Integer> pair : _HISTOLOGY_RANGES) { + if (Utils.isContained(pair.getLeft(), hist)) { + histologyGroup = pair.getRight(); + break; + } + } } return histologyGroup; @@ -204,18 +209,18 @@ private static boolean isNosVsSpecific(IarcMpInputRecordDto rec1, IarcMpInputRec //14 is NOS for 8-13 //5 is NOS for 1-4 return (rec1.getHistGroup() == 17 && ((rec2.getHistGroup() >= 1 && rec2.getHistGroup() <= 7) || rec2.getHistGroup() == 15 || rec2.getHistGroup() == 16)) || - (rec2.getHistGroup() == 17 && ((rec1.getHistGroup() >= 1 && rec1.getHistGroup() <= 7) || rec1.getHistGroup() == 15 || rec1.getHistGroup() == 16)) || - (rec1.getHistGroup() == 14 && rec2.getHistGroup() >= 8 && rec2.getHistGroup() <= 13) || - (rec2.getHistGroup() == 14 && rec1.getHistGroup() >= 8 && rec1.getHistGroup() <= 13) || - (rec1.getHistGroup() == 5 && rec2.getHistGroup() >= 1 && rec2.getHistGroup() <= 4) || - (rec2.getHistGroup() == 5 && rec1.getHistGroup() >= 1 && rec1.getHistGroup() <= 4); + (rec2.getHistGroup() == 17 && ((rec1.getHistGroup() >= 1 && rec1.getHistGroup() <= 7) || rec1.getHistGroup() == 15 || rec1.getHistGroup() == 16)) || + (rec1.getHistGroup() == 14 && rec2.getHistGroup() >= 8 && rec2.getHistGroup() <= 13) || + (rec2.getHistGroup() == 14 && rec1.getHistGroup() >= 8 && rec1.getHistGroup() <= 13) || + (rec1.getHistGroup() == 5 && rec2.getHistGroup() >= 1 && rec2.getHistGroup() <= 4) || + (rec2.getHistGroup() == 5 && rec1.getHistGroup() >= 1 && rec1.getHistGroup() <= 4); } private static boolean needToUpdateHistology(IarcMpInputRecordDto primaryRec, IarcMpInputRecordDto dupRecord) { return (primaryRec.getHistGroup() == 17 && ((dupRecord.getHistGroup() >= 1 && dupRecord.getHistGroup() <= 7) || dupRecord.getHistGroup() == 15 || dupRecord.getHistGroup() == 16)) || - (primaryRec.getHistGroup() == 14 && dupRecord.getHistGroup() >= 8 && dupRecord.getHistGroup() <= 13) || - (primaryRec.getHistGroup() == 5 && dupRecord.getHistGroup() >= 1 && dupRecord.getHistGroup() <= 4) || - (primaryRec.getHistGroup().equals(dupRecord.getHistGroup()) && NumberUtils.toInt(primaryRec.getHistology()) < NumberUtils.toInt(dupRecord.getHistology())); + (primaryRec.getHistGroup() == 14 && dupRecord.getHistGroup() >= 8 && dupRecord.getHistGroup() <= 13) || + (primaryRec.getHistGroup() == 5 && dupRecord.getHistGroup() >= 1 && dupRecord.getHistGroup() <= 4) || + (primaryRec.getHistGroup().equals(dupRecord.getHistGroup()) && NumberUtils.toInt(primaryRec.getHistology()) < NumberUtils.toInt(dupRecord.getHistology())); } private static class InternalRecDto implements Comparable { diff --git a/src/main/java/com/imsweb/algorithms/internal/Utils.java b/src/main/java/com/imsweb/algorithms/internal/Utils.java index aac8592..611b647 100644 --- a/src/main/java/com/imsweb/algorithms/internal/Utils.java +++ b/src/main/java/com/imsweb/algorithms/internal/Utils.java @@ -211,10 +211,6 @@ public static boolean isContained(List list, Integer value) { return false; } - public static boolean isHistologyContained(String list, Integer value) { - return isContained(expandHistologiesAsIntegers(list), value); - } - public static Map extractPatient(AlgorithmInput input) { return input.getPatient() == null ? Collections.emptyMap() : input.getPatient(); } diff --git a/src/main/java/com/imsweb/algorithms/napiia/NapiiaUtils.java b/src/main/java/com/imsweb/algorithms/napiia/NapiiaUtils.java index 04bb1e2..eebd935 100644 --- a/src/main/java/com/imsweb/algorithms/napiia/NapiiaUtils.java +++ b/src/main/java/com/imsweb/algorithms/napiia/NapiiaUtils.java @@ -5,8 +5,10 @@ import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.commons.lang3.StringUtils; @@ -84,11 +86,11 @@ public final class NapiiaUtils { } //Asian birth place countries excluded from indirect identification based on names - private static final List _BPC_EXCLUDE_ASIAN = Arrays.asList("MDV", "NPL", "BTN", "BGD", "LKA", "MMR", "XMS", "MYS", "SGP", "BND", "IDN", "TLS", "MNG"); + private static final Set _BPC_EXCLUDE_ASIAN = new HashSet<>(Arrays.asList("MDV", "NPL", "BTN", "BGD", "LKA", "MMR", "XMS", "MYS", "SGP", "BND", "IDN", "TLS", "MNG")); //Hispanic birth place countries excluded from identification based on names - private static final List _BPC_EXCLUDE_HISP = Arrays.asList("PRI", "MEX", "CUB", "DOM", "ZZC", "GTM", "HND", "SLV", "NIC", "CRI", "PAN", "ZZS", "COL", "VEN", "ECU", "PER", "BOL", "CHL", - "ARG", "PRY", "URY", "ESP", "AND"); - private static final List _SPANISH_ORIGIN_IS_SPANISH = Arrays.asList("1", "2", "3", "4", "5", "6", "8"); + private static final Set _BPC_EXCLUDE_HISP = new HashSet<>(Arrays.asList("PRI", "MEX", "CUB", "DOM", "ZZC", "GTM", "HND", "SLV", "NIC", "CRI", "PAN", "ZZS", "COL", "VEN", "ECU", "PER", + "BOL", "CHL", "ARG", "PRY", "URY", "ESP", "AND")); + private static final Set _SPANISH_ORIGIN_IS_SPANISH = new HashSet<>(Arrays.asList("1", "2", "3", "4", "5", "6", "8")); //lookups private static final Map _LKUP_NAPIIA_SURNAME_CENSUS_ASIAN = new HashMap<>(); diff --git a/src/main/java/com/imsweb/algorithms/nhia/NhiaUtils.java b/src/main/java/com/imsweb/algorithms/nhia/NhiaUtils.java index 5823436..45751e7 100644 --- a/src/main/java/com/imsweb/algorithms/nhia/NhiaUtils.java +++ b/src/main/java/com/imsweb/algorithms/nhia/NhiaUtils.java @@ -56,34 +56,35 @@ public final class NhiaUtils { private static final String _GENDER_FEMALE = "2"; // spanish/Hispanic origins for direct identification - private static final List _DIRECT_IDENTIFICATION_ORIGINS = Arrays.asList("1", "2", "3", "4", "5", "6", "8"); + private static final Set _DIRECT_IDENTIFICATION_ORIGINS = new HashSet<>(Arrays.asList("1", "2", "3", "4", "5", "6", "8")); // spanish/Hispanic origins for indirect identification - private static final List _INDIRECT_IDENTIFICATION_ORIGINS = Arrays.asList("0", "6", "7", "9"); + private static final Set _INDIRECT_IDENTIFICATION_ORIGINS = new HashSet<>(Arrays.asList("0", "6", "7", "9")); // Birthplace countries corresponding to NHIA of MEXICAN (under the High Probability of Hispanic Ethnicity in documentation) - private static final List _BPC_MEXICAN = Collections.singletonList("MEX"); + private static final Set _BPC_MEXICAN = new HashSet<>(Collections.singletonList("MEX")); // birthplace countries corresponding to NHIA of PERTO-RICAN (under the High Probability of Hispanic Ethnicity in documentation) - private static final List _BPC_PUERTO_RICAN = Collections.singletonList("PRI"); + private static final Set _BPC_PUERTO_RICAN = new HashSet<>(Collections.singletonList("PRI")); // birthplace countries corresponding to NHIA of CUBAN (under the High Probability of Hispanic Ethnicity in documentation) - private static final List _BPC_CUBAN = Collections.singletonList("CUB"); + private static final Set _BPC_CUBAN = new HashSet<>(Collections.singletonList("CUB")); // birthplace countries corresponding to NHIA of SOUTH-CENTRAL-AMERICAN (under the High Probability of Hispanic Ethnicity in documentation) - private static final List _BPC_SOUTH_CENTRAL_AMER = Arrays.asList("ZZC", "GTM", "HND", "SLV", "NIC", "CRI", "PAN", "ZZS", "COL", "VEN", "ECU", "PER", "BOL", "CHL", "ARG", "PRY", "URY"); + private static final Set _BPC_SOUTH_CENTRAL_AMER = new HashSet<>( + Arrays.asList("ZZC", "GTM", "HND", "SLV", "NIC", "CRI", "PAN", "ZZS", "COL", "VEN", "ECU", "PER", "BOL", "CHL", "ARG", "PRY", "URY")); // birthplace countries corresponding to NHIA of OTHER-SPANISH (under the High Probability of Hispanic Ethnicity in documentation) - private static final List _BPC_OTHER_SPANISH = Arrays.asList("ESP", "AND"); + private static final Set _BPC_OTHER_SPANISH = new HashSet<>(Arrays.asList("ESP", "AND")); // birthplace countries corresponding to NHIA of DOMINICAN-REPUBLIC (under the High Probability of Hispanic Ethnicity in documentation) - private static final List _BPC_DOMINICAN_REP = Collections.singletonList("DOM"); + private static final Set _BPC_DOMINICAN_REP = new HashSet<>(Collections.singletonList("DOM")); // race being excluded from Indirect Identification - private static final List _RACE_EXCLUDED = Arrays.asList("03", "06", "07"); + private static final Set _RACE_EXCLUDED = new HashSet<>(Arrays.asList("03", "06", "07")); // special Asian and Pacific Islander - private static final List _RACE_PACIFIC = Arrays.asList("96", "97"); + private static final Set _RACE_PACIFIC = new HashSet<>(Arrays.asList("96", "97")); // cached lookups private static Set _LOW_HISP_ETHN_COUNTIES; diff --git a/src/main/java/com/imsweb/algorithms/prcda/PrcdaUtils.java b/src/main/java/com/imsweb/algorithms/prcda/PrcdaUtils.java index 1c926ed..2ae187a 100644 --- a/src/main/java/com/imsweb/algorithms/prcda/PrcdaUtils.java +++ b/src/main/java/com/imsweb/algorithms/prcda/PrcdaUtils.java @@ -6,7 +6,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashSet; import java.util.List; +import java.util.Set; import com.imsweb.algorithms.StateCountyInputDto; @@ -28,10 +30,10 @@ public final class PrcdaUtils { public static final String PRCDA_UNKNOWN = "9"; // States where every county is PRCDA - public static final List ENTIRE_STATE_PRCDA = Collections.unmodifiableList(Arrays.asList("AK", "CT", "NV", "OK", "SC")); + public static final Set ENTIRE_STATE_PRCDA = Collections.unmodifiableSet(new HashSet<>(Arrays.asList("AK", "CT", "NV", "OK", "SC"))); // States where every county is non-PRCDA - public static final List ENTIRE_STATE_NON_PRCDA; + public static final Set ENTIRE_STATE_NON_PRCDA; static { List nonPrcda = new ArrayList<>(Arrays.asList("AR", "DE", "DC", "GA", "HI", "IL", "KY", "MD", "MO", "NH", "NJ", "OH", "TN", "VT", "WV")); List territory = Arrays.asList("AS", "GU", "MP", "PW", "PR", "UM", "VI", "FM", "MH", "TT"); @@ -41,7 +43,7 @@ public final class PrcdaUtils { nonPrcda.addAll(territory); nonPrcda.addAll(province); nonPrcda.addAll(military); - ENTIRE_STATE_NON_PRCDA = Collections.unmodifiableList(nonPrcda); + ENTIRE_STATE_NON_PRCDA = Collections.unmodifiableSet(new HashSet<>(nonPrcda)); } private static final PrcdaDataProvider _PROVIDER = new PrcdaDataProvider();