Scala Get First and Last elements of List using Pattern Matching
I am doing a pattern matching on a list. Is there anyway I can access the first and last element of the list to compare? 

I want to do something like..

    case List(x, _*, y) if(x == y) => true

or

`case x :: _* :: y => `

or something similar... 
where `x` and `y` are first and last elements of the list..

How can I do that.. any Ideas?


Scala Get First and Last elements of List using Pattern Matching
===

I am doing a pattern matching on a list. Is there anyway I can access the first and last element of the list to compare? 

I want to do something like..

    case List(x, _*, y) if(x == y) => true

or

`case x :: _* :: y => `

or something similar... 
where `x` and `y` are first and last elements of the list..

How can I do that.. any Ideas?

