Investors should favor companies that have wide moats and can adapt.

If you want to buy tech stocks that you can comfortably hold for the next two decades, you need to find companies with wide moats and the ability to adapt.

Let's look at five tech leaders who have precisely those attributes.

1. Nvidia

Nvidia ( NVDA -4.84% ) started out as a chipmaker supporting the video game industry: Its graphics processing units (GPUs) were designed to speed up graphics rendering in video games. However, it also created its CUDA software platform, which allows developers to program its chips for specific tasks, and cleverly gave it away free to universities and research labs -- including the places where early work on artificial intelligence (AI) was taking place.

That decision change

See Full Page