use of cl.smartcities.isci.transportinspector.model.gson.ServerSentBus in project androidApp by InspectorIncognito.
the class BusSelectionDialog method setBusMap.
/**
* Creates a hashMap using a list of buses. This hashMap needed for the adapter.
*/
private void setBusMap(ArrayList<ServerSentBus> busList) {
this.busMap = new HashMap<>();
for (ServerSentBus bus : busList) {
String service = bus.getService();
// If the map does not contain the service
if (!this.busMap.containsKey(service)) {
ArrayList<ServerSentBus> sameServiceBusList = new ArrayList<>();
sameServiceBusList.add(bus);
this.busMap.put(service, sameServiceBusList);
} else {
ArrayList<ServerSentBus> sameServiceBusList = this.busMap.get(service);
sameServiceBusList.add(bus);
}
}
}
Aggregations