Sobes.tech
Junior — Senior

Selection of events with unique types

livecode

Task condition

It is necessary to write a method that:

  • receives a list of events (List<Event>);
  • returns only those events whose types are unique (identified by EventType.id());
  • if there are multiple events of the same type, leaves the first found.
public interface Event {
    String id();
    EventType type();
}

public interface EventType {
    String id();
}