VcsCommitMetadata () { if (!myFirst.hasNext()) return mySecond.next(); if (!mySecond.hasNext()) return myFirst.next(); VcsCommitMetadata data1 = myFirst.peek(); VcsCommitMetadata data2 = mySecond.peek(); // more recent commits (with bigger timestamp) should go first // if timestamp is the same, commit from the second list is chosen if (data1.getTimestamp() > data2.getTimestamp()) return myFirst.next(); return mySecond.next(); }