Apple (AAPL 0.06%) and Samsung (NASDAQOTH:SSNLF) continue to duke it out in the mobile electronics wars as Apple's latest incarnation of the iPhone, the iPhone 5, goes up against Samsung's just-released Galaxy S5. The two companies also battle for consumers with their tablets as Apple's iPads compete with Samsung's Galaxy Tabs. While these companies compete with one another through their operations, they also compete with each other for patents as well. The electronics makers battle each other in the courtroom as well as at their stores around the world.

Apple wins a battle in court
Apple scored a victory against Samsung in a U.S. courtroom on Friday, May 2, 2014 by winning a patent suit. The jury found that Samsung infringed on two of Apple's patents and ordered Samsung to pay $119.6 million to Apple. Apple's suit accused Samsung of infringing on several of Apple's iPhone features, including its universal search and slide to unlock functions.

Apple had been seeking over $2 billion in damages so the $119.6 was minuscule on a relative basis. Apple did win a suit in 2012 against Samsung, however, in which the court ordered Samsung to pay Apple over $900 million. Nonetheless, both of these companies are well-capitalized so hundred-million dollar fines do not greatly affect them. Both companies have also been trying to ban the sale of each other's products in their suits, but neither has been successful up to this point.

Out of court the competition heats up
Out of the courtroom, the companies are experiencing increasing competition from not only each other but also from the other players in the market. According to Strategy Analytics, both Samsung and Apple lost share in the global smartphone market in the first quarter of 2014. Samsung's share dropped to 31% from 32% in 2013's first quarter. Apple's share dipped even more, dropping to 15% from 17% in the same quarter of the prior year.

Apple's drop wasn't as dire though as its phones are only on the higher end of the market and command higher margins than Samsung phones. Apple's strategy has always been to offer premium products, so market share isn't as important for Apple as it is for other manufacturers that concentrate on delivering their products at the lowest cost.

Apple as an investment
Apple's stock continues to look attractive with a dividend yield of 2.3% and $23 billion of share repurchases over the last six months. The company also announced that it will be increasing its dividend by about 8% to $13.16 per share and its share repurchase program will also increase to $90 billion from $60 billion. The company plans to return a staggering $130 billion to its shareholders through 2015 under its capital return program. With a reduced share count and an increased dividend, Apple's stock is looking increasingly attractive.

Furthermore, Apple trades at a price-to-earnings ratio of only 14.2. In sharp contrast, the S&P 500 trades at a P/E of 18. Apple also trades at a low forward P/E of 12.1 against the market's 16.7. So Apple is much cheaper than the overall market on a current and future basis. Investors are valuing Apple's earnings at less than the S&P 500 average, but Apple is also a significant cash generator. Apple generated $36.2 billion of cash flow from operations in just the last six months and $28.2 billion of free cash flow over the same period. Apple has the unique and enviable problem of trying to figure out what to do with all of its cash.

Apple's future looks bright
Apple is just coming off a quarter in which it increased both its revenue and earnings from the prior year's quarter. On revenue of $45.6 billion, Apple generated a profit of $10.2 billion or $11.62 per share and its gross margin increased to 39.3% from 37.5% in the second quarter of 2013. The company has shown resilience in a tough phone and tablet market and it has delivered record results, beating Wall Street's estimates in addition to its own. It will continue to go back and forth with Samsung in the courts, but the recent suits have not proven material to its business. Given its valuation, Apple should produce good returns for investors going forward.