Extract Common Data From List of Objects
Basically, this boils down to the question of how to find out whether a given number of items is always the same. The mathematical tool for this is a set and checking its cardinality.

Putting this into code, you can use a Set implementation in Java:

Set&lt;LocalDate&gt; allStartDates = new HashSet&lt;&gt;();

for (...) {
    ...
    allStartDates.add(order.getStartDate());
    ...
}

if (allStartDates.size() == 1)
    commonData.setCommonStartDate(allStartDates.iterator().next());


BUT: in a real-world-application, I'd move this logic to the CommonData class.

Basically, redesign the CommonData in a way, that you can simply add an order and then boil the loop down to:

CommonData commonData = new CommonData();
orders.stream().forEach(commonData::add);


and inside the common data add method, add the codes and ids, maintain two sets of dates, and do the if-logic in the appropriate getters.