Passage
With the elect thou wilt be elect: and with the perverse thou wilt be perverted.
With the elect thou wilt be elect: and with the perverse thou wilt be perverted.
2 Samuel 22:25 And the Lord will recompense me according to my justice: and according to the cleanness of my hands in the sight of his eyes.
2 Samuel 22:26 With the holy one thou wilt be holy: and with the valiant perfect.
2 Samuel 22:27 With the elect thou wilt be elect: and with the perverse thou wilt be perverted.
2 Samuel 22:28 And the poor people thou wilt save: and with thy eyes thou shalt humble the haughty.
2 Samuel 22:29 For thou art my lamp O Lord: and thou, O Lord, wilt enlighten my darkness.
The verse centers on "elect", "thou", "wilt", "perverse", and "perverted". It is saying that the verse draws attention to "elect" and "thou", so its meaning should be read from those terms before moving to application.
The nearby context moves from verse 26's "With the holy one thou wilt be..." into verse 28's "And the poor people thou wilt save...", so "elect" and "thou" belong inside that flow. In 2 Samuel context, the local focus is covenant, worship, and faithfulness.
A plain takeaway is to answer the verse's own emphasis on "elect" and "thou" with trust shaped by these words, not by a vague optimism outside the passage.