From all those who have taught me I have gained wisdom (Psalms 119:99).
The Psalmist is telling us that he learned from everyone, that everyone was his teacher. From some, he learned what to do; from others, what not to do.
If we learn from others' mistakes, we need not make our own.
Just as we can learn from every person, we can learn from every event. Positive experiences are obvious sources of learning, because each positive act we do adds to our character and prepares us to better face the next challenge in life. Negative experiences can be valuable, too, but only if we are sufficiently alert to learn from them.
The list of lessons that we have learned the hard way may be long, but each one has taught us what not to do and thereby it becomes a positive experience. Indeed, the Talmud states that when people sincerely regret their mistakes and change themselves for the better, the wrongs that they did become actual merits (Yoma 86b). Only when we fail to learn from our mistakes and, rationalizing and justifying, obstinately insist that we were right, do our misdeeds remain deficits.
We have the capacity to make life itself a tremendous learning and growth experience.