public static boolean isContiguous(List<Partition> partitions) {
        if (partitions.size() == 0) {
            return true;
        }

        // DCI: copied from python. Why again?
        Partition lastPartition = partitions.get(partitions.size() - 1);
        if (lastPartition.getStart() > lastPartition.getEnd()) {
            return false;
        }

        for (int index = 0; index < partitions.size() - 1; index++) {
            Partition current = partitions.get(index);
            if (current.getStart() > current.getEnd()) {
                return false;
            }
            Partition next = partitions.get(index + 1);
            int span = next.getStart() - current.getEnd();
            if (span < 0  || span > 1) {
                return false;
            }
        }
        return true;
    }