class TransportManager {

  protected Map<String, List<Transport>> groupByName() {
    Map<String, List<Transport>> groups = new HashMap<>();
    for (Transport transport : transports) {
      List<Transport> list = groups.computeIfAbsent(transport.getName(), name -> new ArrayList<>());
      list.add(transport);
    }
    return groups;
  }

}