2 Samuel 22:24
I was also upright before him, and have kept myself from mine iniquity.
Cross-reference
Genesis 6:9
Parallel
In Genesis 6:9, Noah is described as blameless — the same term David uses to describe himself before God.
Job 1:1
Parallel
Job 1:1 describes Job as blameless and shunning evil — directly echoing David's claim of blamelessness and keeping from iniquity.
Psalm 84:11
Related theme
Psalm 84:11 promises God's blessing to those who walk uprightly — affirming the basis for David's confidence in God's reward.
Ezekiel 18:8
Parallel
Ezekiel 18:8 describes a righteous person who 'withdrew his hand from iniquity' — nearly identical phrasing to David's 'kept myself from my iniquity'.