We have duplicated code between the two implementations. Centralize it
to the common superclass.
JIRA: CONTROLLER-2098
Change-Id: I805e882566d8f891c23a1f25143d453c94284cd1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
}
}
- @Override
- long getLastIndex() {
- return lastEntry != null ? lastEntry.index() : firstIndex - 1;
- }
-
@Override
Indexed<E> getLastEntry() {
return lastEntry;
*
* @return The last written index.
*/
- abstract long getLastIndex();
+ final long getLastIndex() {
+ final Indexed<?> lastEntry;
+ return (lastEntry = getLastEntry()) != null ? lastEntry.index() : firstIndex - 1;
+ }
/**
* Returns the last entry written.
}
}
- @Override
- long getLastIndex() {
- return lastEntry != null ? lastEntry.index() : firstIndex - 1;
- }
-
@Override
Indexed<E> getLastEntry() {
return lastEntry;