Ending intervals multiple times is safe, we only write the interval if it was open and not empty.
Writes the interval to the pathDetails

@param lastIndex the index the PathDetail ends
964735
public void endInterval(int lastIndex) {
        if (isOpen) {
            currentDetail.setLast(lastIndex);
            pathDetails.add(currentDetail);
        }
        isOpen = false;
    }
1236974
public void setInterval(ReadableInstant start, ReadableInstant end) {
        if (start == null && end == null) {
            long now = DateTimeUtils.currentTimeMillis();
            setInterval(now, now);
        } else {
            long startMillis = DateTimeUtils.getInstantMillis(start);
            long endMillis = DateTimeUtils.getInstantMillis(end);
            Chronology chrono = DateTimeUtils.getInstantChronology(start);
            super.setInterval(startMillis, endMillis, chrono);
        }
    }
617031
@Override
	public int lastIndexOf(Object elem) {
		if (elem == null) return -1;
		if (elem instanceof Number) return lastIndexOf(((Number)elem).intValue());
		return -1;
	}
1097616
@Override
    public void end(final Xid _xid,
                    final int _flags)
    {
        AbstractResource.LOG.trace("end resource {}, flags {}" + _flags, _xid, _flags);
    }
1336031
private void recordIndex(int index) {
        stateLock.writeLock().lock();
        try {
            int insertionPoint = -Arrays.binarySearch(effectiveIndex, index) - 1;
            System.arraycopy(effectiveIndex, insertionPoint, effectiveIndex, insertionPoint + 1, effectiveIndex.length - insertionPoint - 1);
            effectiveIndex[insertionPoint] = index;
        } finally {
            stateLock.writeLock().unlock();
        }
    }
770757
@Override
    public int last() {
        fCachedBreakPositions = null;
        fDictionaryCharCount = 0;
        fPositionInCache = 0;

        if (fText == null) {
            fLastRuleStatusIndex  = 0;
            fLastStatusIndexValid = true;
            return BreakIterator.DONE;
        }

        // t.last() returns the offset of the last character,
        // rather than the past-the-end offset
        // so a loop like for(p=it.last(); p!=DONE; p=it.previous()) ...
        // will work correctly.
        fLastStatusIndexValid = false;
        int pos = fText.getEndIndex();
        fText.setIndex(pos);
        return pos;
    }
140734
public void set(long startIndex, long endIndex)
    {
        if (endIndex <= startIndex) return;

        int startWord = (int) (startIndex >> 6);

        // since endIndex is one past the end, this is index of the last
        // word to be changed.
        int endWord = expandingWordNum(endIndex - 1);

        long startmask = -1L << startIndex;
        long endmask = -1L >>> -endIndex; // 64-(endIndex&0x3f) is the same as -endIndex
                                          // due to wrap

        if (startWord == endWord)
        {
            bits[startWord] |= (startmask & endmask);
            return;
        }

        bits[startWord] |= startmask;
        Arrays.fill(bits, startWord + 1, endWord, -1L);
        bits[endWord] |= endmask;
    }
482262
boolean manageIdlePool(ThreadPoolExecutor threadPool, long intervalCompleted) {

        // Manage the intervalCompleted count
        if (intervalCompleted == 0 && threadPool.getActiveCount() == 0) {
            consecutiveIdleCount++;
        } else {
            consecutiveIdleCount = 0;
        }

        if (consecutiveIdleCount >= IDLE_INTERVALS_BEFORE_PAUSE) {
            pause();
            lastAction = LastAction.PAUSE;
            return true;
        }

        return false;
    }
866154
@Pure
	public int lastIndexOf(RoadSegment segment) {
		int count = 0;
		int index;
		int lastIndex = -1;
		for (final RoadPath p : this.paths) {
			index = p.lastIndexOf(segment);
			if (index >= 0) {
				lastIndex = count + index;
			}
			count += p.size();
		}
		return lastIndex;
	}
1106993
@Override
    public void endLink(ResourceReference reference, boolean freestanding, Map<String, String> parameters)
    {
        this.previousEvents.endLink(reference, freestanding, parameters);
        firePreviousEvent();
    }
1296998
public void closePath() {
		if (this.numTypes<=0 ||
				(this.types[this.numTypes-1]!=PathElementType.CLOSE
				&&this.types[this.numTypes-1]!=PathElementType.MOVE_TO)) {
			ensureSlots(true, 0);
			this.types[this.numTypes++] = PathElementType.CLOSE;
		}
	}
297373
public int lastIndexOf(Object o) {
		int index = -1;
		try {
			for (int i = 0; i < events.size(); i++) {
				if (events.get(i).equals(o)) {
					index = i;
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return index;
	}
226558
public void clear(int startIndex, int endIndex)
    {
        if (endIndex <= startIndex) return;

        int startWord = (startIndex >> 6);
        if (startWord >= wlen) return;

        // since endIndex is one past the end, this is index of the last
        // word to be changed.
        int endWord = ((endIndex - 1) >> 6);

        long startmask = -1L << startIndex;
        long endmask = -1L >>> -endIndex; // 64-(endIndex&0x3f) is the same as -endIndex
                                          // due to wrap

        // invert masks since we are clearing
        startmask = ~startmask;
        endmask = ~endmask;

        if (startWord == endWord)
        {
            bits[startWord] &= (startmask | endmask);
            return;
        }

        bits[startWord] &= startmask;

        int middle = Math.min(wlen, endWord);
        Arrays.fill(bits, startWord + 1, middle, 0L);
        if (endWord < wlen)
        {
            bits[endWord] &= endmask;
        }
    }
1255348
public void write(final AbstractIndex index)
		throws IOException
	{

		StringBuilder cmd;

		while (index.size() > 0) {

			System.out.println("Transmit Index [" + index + "]");

			cmd = index.remove();

			if(index instanceof ArticleIndex){
				articleIdxWriter.write(cmd.toString());
			}else if(index instanceof ChronoIndex){
				chronoIdxWriter.write(cmd.toString());
			}else if(index instanceof RevisionIndex){
				revisionIdxWriter.write(cmd.toString());
			}

		}

		if(index instanceof ArticleIndex){
			articleIdxWriter.flush();
		}else if(index instanceof ChronoIndex){
			chronoIdxWriter.flush();
		}else if(index instanceof RevisionIndex){
			revisionIdxWriter.flush();
		}
	}
909697
@Override
    public int lastIndexOf(Object o) {
        if (displacement != null) {
            return super.lastIndexOf(o) + displacement;
        }
        return super.lastIndexOf(o);
    }
488999
public boolean hasSpansIntersecting(int start, int end) {
        for (int i = 0; i < numberOfSpans; i++) {
            // equal test is valid since both intervals are not empty by construction
            if (spanStarts[i] >= end || spanEnds[i] <= start) continue;
            return true;
        }
        return false;
    }
1083410
@Override
	public int lastIndexOf(long elem) {
		// Find the location to insert the object at
		int pos=binarySearch(elem);

		// Not found
		if(pos<0) return -1;

		// Found one, iterate forwards to the last one
		while(pos<(size-1) && elementData[pos+1]==elem) pos++;
		return pos;
	}