Image source: Microsoft.

So much can change in just a few years, making the idea of holding a particular stock forever seem like a bad idea. But there are a few companies that are so strong, with durable competitive advantages and long track records of success, that investors can feel comfortable simply buying and holding their stocks for the rest of time. Here are three stocks that our Foolish contributors have identified as ideal buy-and-hold candidates.

Tim Green: A few years ago, Microsoft (MSFT 0.46%) seemed like a company that had lost its way. The PC, for a long time the only relevant computing device, was joined by the smartphone and other mobile devices, mostly running either iOS or Android. The most profitable parts of Microsoft, Office and Windows, appeared to be in serious trouble.

But under CEO Satya Nadella, the company has shifted its strategy to focus on mobile and the cloud. Windows 10, available as a free upgrade to consumers, is the fastest-growing version of Windows to date, and Office 365, the subscription version of Office, is racking up subscribers. Azure, Microsoft's cloud computing platform, is a strong player in the infrastructure-as-a-service market, while the company's devices, including the Surface Pro 4 and Surface Book, are selling well.

Microsoft's focus is still on enabling productivity, and while its business model may be changing, its dominance in the enterprise software market remains. Like many large, entrenched technology companies, Microsoft was forced to innovate by the rise of the cloud and mobile devices. Unlike many large, entrenched technology companies, Microsoft appears so far to be doing all the right things. While the company's revenue and profits are currently under pressure, I suspect that in the long run, investors buying and holding Microsoft will be happy with that decision.

Dan Caplinger: The athletic footwear and apparel industry has never been hotter, and there's no more recognized brand in the industry than Nike (NKE -0.36%). The company pioneered the sports apparel business, producing decades of growth and becoming a global colossus in part by building lucrative sponsor partnerships with top-name athletes in just about every sport you can think of, most notably NBA legend Michael Jordan.

Even in the face of rising competition from Under Armour and other less mature companies, Nike has nevertheless maintained its ability to grow at a healthy pace. In its most recent quarterly report, Nike reported a 4% rise in revenue that produced earnings growth of 22%, despite facing brisk currency-related headwinds from the strong U.S. dollar. On a currency-neutral basis, double-digit percentage growth in all of Nike's geographical areas showed how well the athletic giant has done even in weaker emerging market economies like Brazil, with its efforts to appeal to the huge worldwide soccer market during the 2014 FIFA World Cup having paid dividends.

Nike has consistently sported a high earnings multiple, reflecting its growth opportunities, and so it rarely resembles what most people would think of as a value stock. Nevertheless, with demographic trends supporting its continued success, Nike should be able to keep performing well into the future.

Sean Williams: This is probably an answer I've given before, but given my healthcare bias, I see no reason why investors -- be they growth, value, or income seekers -- can't buy and hold Johnson & Johnson (JNJ 0.82%) forever.

Johnson & Johnson has a little bit of something for every investor. It offers incredible diversification considering that it's comprised of more than 250 subsidiaries. This allows J&J to purchase new companies that can complement its faster-growing operations while also divesting slower-growth operations with ease.

This diversification is also apparent in its three-tiered operational approach, where each segment serves a purpose. Johnson & Johnson's consumer healthcare operations may not offer high growth, but its lineup of products generates predictable cash flow and its pricing power remains strong in both good and bad economic environments.

Likewise, J&J's medical device operations have been growing at a slower-than-expected pace, which has tied cost uncertainties with the Affordable Care Act. However, an aging global population that's living longer than ever plays right into J&J's hands over the long term. Lastly, its pharmaceutical segment is where its juicy margins and high growth comes from. J&J introduced 14 novel medicines between 2009 and 2014, of which half wound up netting it $1 billion, or more, in annual sales.

Johnson & Johnson is also one of just three AAA-rated publicly traded companies according to Standard & Poor's, which is a reflection of its $18.5 billion in net cash, as well as its consistently strong cash flow generation.

Lastly, with J&J you get a 3% dividend yield, which is nicely above the 2.4% average yield of S&P 500 companies and a 53-year streak of dividend increases. You can count on two hands how many companies have a longer active streak of boosting their annual payout.

Johnson & Johnson is the epitome of "set it and forget it."