Revenge is short-lived, justice is forever.
This realization does not happen until Hamlet has blown off steam and examined both his own conscience and the ramifications of swift revenge. Finally, it hits him: "Why, what an ass am I! This is most brave,/That I, the son of a dear father murdered,/Prompted my revenge by heaven and hell,/Must like a whore, unpack my heart with words...".
Through these lines of "self-talk" Hamlet realizes that merely revenge will be served if he acts in haste. Much better than revenge is justice. By the conclusion of the soliloquy, Hamlet has formed his plan of entrapment. "The plays the thing" he decides, that will ferret out the reluctant conscience of the evil Claudius. And justice is sweeter than any rash revenge could ever be.