Skip to content

Commit

Permalink
indexing changes for #1046
Browse files Browse the repository at this point in the history
  • Loading branch information
djtfmartin committed Sep 19, 2024
1 parent 02001d9 commit 2aaf566
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ public static Classification convertToClassification(TaxonRecord taxon) {
.ifPresent(classificationBuilder::setClassificationPath);

JsonConverter.convertClassificationDepth(taxon)
.ifPresent(classificationBuilder::setClassificationDepth);
.ifPresent(classificationBuilder::setClassificationDepth);

JsonConverter.convertRankPath(taxon).ifPresent(classificationBuilder::setRankPath);

Expand Down Expand Up @@ -581,16 +581,16 @@ public static Optional<String> convertClassificationPath(TaxonRecord taxonRecord
*/
public static Optional<Map<String, String>> convertClassificationDepth(TaxonRecord taxonRecord) {
if (taxonRecord.getClassification() == null
|| taxonRecord.getClassification().isEmpty()
|| taxonRecord.getUsage() == null) {
|| taxonRecord.getClassification().isEmpty()
|| taxonRecord.getUsage() == null) {
return Optional.empty();
}

Map<String, String> depthMap = new LinkedHashMap<>();
AtomicInteger idx = new AtomicInteger(0); // Using AtomicInteger to handle index
taxonRecord.getClassification().forEach(taxon ->
depthMap.put(String.valueOf(idx.getAndIncrement()), taxon.getKey())
);
taxonRecord
.getClassification()
.forEach(taxon -> depthMap.put(String.valueOf(idx.getAndIncrement()), taxon.getKey()));
return Optional.of(depthMap);
}

Expand Down

0 comments on commit 2aaf566

Please sign in to comment.