When David was under Saul's persecution, he had two chances to destroy Saul. However, David would not do this because of his fear of God in that Saul was God's anointed (chs. 24, 26). The fact that David would not do anything to damage God's anointed indicates that David maintained a good order in God's kingdom.
Although David had slain Goliath, the giant of the Philistines, and could have been useful to Saul in utterly defeating the Philistines, Saul would not use David to accomplish this but instead persecuted him. David was forced, by Saul's seeking to kill him, to stay in the land of the Philistines (27:1-7).
At the death of Saul David did not rejoice but rather sentenced to death the reporter of Saul's death and then sang a dirge praising and uplifting Saul to the uttermost (2 Sam. 1).
No doubt, David learned a lot regarding not avenging himself but denying himself for the fulfilling of God's purpose, on the basis that he was a man according to God's heart (1 Sam. 13:14a).
David was a person who trusted in God and walked according to God's sovereignty in all his trials (17:36-37; 23:14-16; 30:6b-10). While he was under trial, he sought God's leading. He was one with God and behaved according to God.
David is a typical model of a genuine child of Israel in the enjoyment of the good land promised and given by God to His chosen people, by trusting in God and walking with God according to His leading and instruction. David expected to remain in the good land and share in Jehovah's inheritance and serve Him (26:19b). His sincere trust in God and his faithful walk with God qualified him fully to enjoy the good land to a high level, even up to the kingship in the good land according to God's heart with a kingdom which became the kingdom of God on the earth. David was one with God. What was his was God's, and what was God's was his. He and God had only one kingdom. Such a one enjoyed the good land, Christ, to the uttermost.