Code example for SortedSet

Methods: isEmpty, last

0
    public Optional<Artefact> determineNextBuild(Time t, Optional<TimedArtefact> previousBuild, 
                                                 ArtefactStream parentTarget, ImmutableList<ArtefactStream> siblingTargets) { 
   
        final SortedSet<Artefact> available = parentTarget.availableAt(t); 
         
        if (available.isEmpty()) { 
            return Optional.absent(); 
        } 
         
        final Artefact candidate = available.last(); 
        if (previousBuild.isPresent() && (candidate.compareTo(previousBuild.orNull().artefact()) <= 0)) { 
            return Optional.absent(); 
        } 
         
        return Optional.of(candidate);  
    } 
}