Is the samadhi of Yoga the samadhi of Buddhism? I was wondering if the samadhi of Patanjali Yoga meant the same thing as the samadhi of Buddhism?

A Buddhist friend told me that no, and that Buddhism had higher states after the nirvikalpa samadhi of yogis. But at the same time when I read the descriptions of the two they look similar to me and the samadhi of Buddhism is also the last stage of the Noble Eightfold Path.
The Patanjali system has the following concepts about Samadhi:


Samprajnata Samadhi: one is developing focus on the meditation object but comprehends external stimuli
Asamprajnata Samadhi: one has developed focus on the meditation object hence does not comprehend external stimuli
Savitarka Samadhi: when one experiences a stimulus this triggers a thought process which one can discriminate and abandone or continue
Nirvitarka Samadhi: when one experiences a stimulus one has control over thoughts
Savichara Samadhi: thinking is available
Nirvichara Samadhi: thinking is unavailable


In Buddhism, there are the following concepts of Samadhi:


parikamma samadhi – preliminary concentration
upacara samadhi – access concentration
appana samadhi – fixed concentration
Jhanas - states of samadhi based on the Jhana factors present


Parikamma and upacara samadhi is similar to samprajnata samadhi and appana samadhi is similar to Asamprajnata Samadhi

Vitarka and vichara are Jhana factors. Savitarka indicates there is vitarka and nirvitarka means there is no vitarka and savichara means there is vichara and nirvichara means there is no vichara.

In the Hindu system of samadhi, the object of concentration may be subjected to perversions (vipallasa) hence choose concepts like: permanent, self, pleasant and beautiful. In the Buddhist system, the objects are not subjected to vipallasa. 

In the Hindu system, the object of samadhi is always a conceptual (pannatti) object which is which leads to perversions (vipallasa). In Buddhist systems, the objects can be conceptual or real (paramartha). If it is conceptual after developing Jhana one contemplates the object as impermanent, unsatisfactory and not-self.

When the object chosen is is not subjected to perversion, wholesome and based on something real (paramartha), the concentration gained is Samma Samadhi or the right type of samadhi.