List<RoomSpecialism> roomSpecialismListOfRoom = new ArrayList<RoomSpecialism>(roomSpecialismTokens.length / 2);
for (int j = 0; j < roomSpecialismTokens.length; j += 2) {
int priority = Integer.parseInt(roomSpecialismTokens[j]);
long specialismId = Long.parseLong(roomSpecialismTokens[j + 1]);
if (specialismId != 0) {
RoomSpecialism roomSpecialism = new RoomSpecialism();
roomSpecialism.setId(roomSpecialismId);
roomSpecialism.setRoom(room);
Specialism specialism = idToSpecialismMap.get(specialismId);
if (specialism == null) {
throw new IllegalArgumentException("Read line (" + line
+ ") has a non existing specialismId (" + specialismId + ").");
}
roomSpecialism.setSpecialism(specialism);
roomSpecialism.setPriority(priority);
roomSpecialismListOfRoom.add(roomSpecialism);
roomSpecialismList.add(roomSpecialism);
roomSpecialismId++;
}
}