Skip to content

Commit

Permalink
Cleaned up hashset return
Browse files Browse the repository at this point in the history
  • Loading branch information
nbollis committed Jan 14, 2025
1 parent be82276 commit 513a12b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions mzLib/Omics/Digestion/DigestionAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ protected static bool ValidMaxLength(int? length, int maxLength)
/// <returns></returns>
public List<int> GetDigestionSiteIndices(string sequence)
{
List<int>? indicesList;
var indices = HashSetPool.Get(); // use hash set to ensure no duplicates

try
{
indices.Add(0); // The start of the protein is treated as a cleavage site to retain the n-terminal peptide
Expand Down Expand Up @@ -113,13 +111,12 @@ public List<int> GetDigestionSiteIndices(string sequence)
}

indices.Add(sequence.Length); // The end of the protein is treated as a cleavage site to retain the c-terminal peptide
return indices.ToList();
}
finally
{
indicesList = indices.ToList();
HashSetPool.Return(indices);
}
return indicesList;
}
}
}

0 comments on commit 513a12b

Please sign in to comment.