Scala: How to group by a timestamp an Iterable[T] into an Iterable [T]

I would like to write code that would group a line iterator inputs: Iterator[InputRow] by timestamp an unique items (by unit and eventName), i.e. eventTime should be the latest timestamp in the new Iterator[T] list where InputRow is defined as

case class InputRow(unit:Int, eventName: String, eventTime:java.sql.Timestamp, value: Int)

Example data before grouping:

+-----------------------+----+---------+-----+
|eventTime              |unit|eventName|value|
+-----------------------+----+---------+-----+
|2018-06-02 16:05:11    |2   |B        |1    |
|2018-06-02 16:05:12    |1   |A        |2    |
|2018-06-02 16:05:13    |2   |A        |2    |
|2018-06-02 16:05:14    |1   |A        |3    |
|2018-06-02 16:05:15    |2   |A        |3    |

After:

+-----------------------+----+---------+-----+
|eventTime              |unit|eventName|value|
+-----------------------+----+---------+-----+
|2018-06-02 16:05:11    |2   |B        |1    |
|2018-06-02 16:05:14    |1   |A        |3    |
|2018-06-02 16:05:15    |2   |A        |3    |

I’m new in Scala language.

What is a good approach to writing the above code in Scala?

Scala: How to group by a timestamp an Iterable[T] into an Iterable [T]