Quick revision
The short answer
The interface defines the type, so any class can implement it whatever its superclass, while the skeletal abstract class implements most methods in terms of a few primitives, get and size for AbstractList, so writing a new implementation takes minutes. Implementers can extend the skeleton or, if they already have a superclass, delegate to a private inner subclass of it. Default methods cover part of this today, but they cannot hold state or override Object methods such as equals, so the pattern is still worth using for public types with several expected implementations.
What to remember
In this answer, we saw that the JDK pairs an interface with a skeletal abstract class so that the interface stays a flexible type any class can implement, while the skeleton derives most methods from a few primitives, as AbstractList does from get and size. Implementers with another superclass can delegate to an inner subclass of the skeleton. Default methods replace simple skeletons but cannot hold state or override equals and hashCode, so the pattern remains useful for public types with several expected implementations.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
The interface defines the type, so any class can implement it whatever its superclass, while the skeletal abstract class implements most methods in terms of a few primitives, get and size for AbstractList, so writing a new implementation takes minutes. Implementers can extend the skeleton or, if they already have a superclass, delegate to a private inner subclass of it. Default methods cover part of this today, but they cannot hold state or override Object methods such as equals, so the pattern is still worth using for public types with several expected implementations.
Why this question is asked
The pairing of List with AbstractList, Map with AbstractMap and Collection with AbstractCollection is one of the most quietly influential designs in the JDK. It explains why we can write a correct custom List in ten lines, and it is a pattern we can use in our own libraries when other teams will implement our types. Interviewers ask about it to see whether we understand the separate jobs of a type and an implementation helper, and whether we know what default methods did and did not replace. In this answer, we will recap the two halves of the pattern, build a list from two methods, see how a class with another superclass can still benefit, compare with default methods, and decide when to use the pattern ourselves.
1A Quick Recap of the Two Halves
An interface is a type: it says what operations exist, and any class can implement it, because a class may implement many interfaces. A skeletal implementation is an abstract class that implements the interface and provides real code for most of its methods, written in terms of a small number of primitive methods that it leaves abstract. The name comes from the idea of a skeleton that the implementer only has to flesh out.
The two halves have different audiences. Callers use the interface, List, and never need to know about AbstractList. Implementers use the skeleton when it helps them and ignore it when it does not.
2Building a Full List From Two Methods
To see how much the skeleton does, we can build an immutable list of consecutive numbers by implementing only get and size.
- List interfaceThe type callers use; declares about 30 methods
- AbstractCollectioncontains,
toString,toArray, built oniterator() - AbstractListiterator,
indexOf,subList, equals,hashCode, built on get and size - IntRangeOnly get and size
4 layers, from the top down. Step through them one at a time.
The implementer writes the bottom layer; the skeleton derives the rest from it.
Every line after the class comes from the skeleton. AbstractList provides an iterator built on get and size, and AbstractCollection builds contains and toString on that iterator. AbstractList also implements indexOf, subList, and the equals and hashCode rules that the List contract requires, so our list is equal to any other list with the same elements. Mutators such as add throw by default, which gives us a correct unmodifiable list. If we want a modifiable one, we override set, add(int, E) and remove(int), and everything else follows.
3When the Implementer Already Has a Superclass
Because Java allows only one superclass, a class that already extends something cannot extend the skeleton. The pattern still helps through delegation, sometimes called simulated multiple inheritance. The class implements the interface and keeps a private inner object that extends the skeleton and calls back into the outer class for the primitives. We can show it with a small interface of our own, since the same idea applies to any library type.
The forwarding is a little boilerplate, but CachedRates gets the library's tested logic for find and all without giving up its own superclass. Notice that this is only possible because RateTable is an interface. If the library had published only the abstract class, CachedRates could not be a RateTable at all.
4Do Default Methods Make the Skeleton Unnecessary?
Partly. Since Java 8, an interface can carry default methods, so the derived operations find and all could be defaults in RateTable itself, and many simple skeletons are no longer needed. The JDK did this too: List.sort and Collection.removeIf are defaults.
But defaults have two limits that keep the skeleton useful. First, they cannot hold state, so anything that needs a field, such as AbstractList's modCount, which lets iterators detect concurrent modification, needs a class. Second, a default method cannot override equals, hashCode or toString from Object; the compiler rejects it. Value-based contracts, such as two lists with the same elements being equal, must therefore live in a class. AbstractRateTable's equals is exactly that kind of code.
5When to Use the Pattern in Our Own Library
The pattern earns its place for public types that we expect several teams or plug-ins to implement, where the interface has a few primitive operations and many derived ones. Examples are a storage abstraction with read and write as primitives and many conveniences on top, or a rate table like ours. Publishing the interface keeps implementers free to choose their superclass, and the skeleton makes a correct implementation cheap.
For an internal interface with one or two implementations, it is usually overkill. Default methods or a single concrete class are enough, and the extra type only adds reading cost. A good test is to ask whether an outsider will write an implementation in the next year. If yes, consider the pair; if not, keep it simple.
6Follow-up questions
Why is the skeleton abstract instead of a full default implementation?
Because it does not know how to store or fetch the data. The primitives, such as get and size, depend entirely on the implementer's representation, so they stay abstract. Everything that can be expressed in terms of them is implemented once in the skeleton.
What does AbstractSequentialList add?
AbstractList assumes fast random access through get(int). AbstractSequentialList is a skeleton for lists that are naturally accessed in order, like linked lists: the implementer provides listIterator and size, and get(int) is built by walking the iterator. LinkedList extends it.
Should the skeletal class be part of the public API?
Yes, it should be public and documented for implementers, including which methods are primitives and which derived methods call which. That documentation of self-use is what lets implementers override a derived method safely for performance without breaking the others.
7Conclusion
In this answer, we saw that the JDK pairs an interface with a skeletal abstract class so that the interface stays a flexible type any class can implement, while the skeleton derives most methods from a few primitives, as AbstractList does from get and size. Implementers with another superclass can delegate to an inner subclass of the skeleton. Default methods replace simple skeletons but cannot hold state or override equals and hashCode, so the pattern remains useful for public types with several expected implementations.
Open with
The interface and the skeleton do different jobs. The interface, List, is the type: callers depend on it, and any class can implement it whatever its superclass. The skeletal class, AbstractList, implements most of the interface in terms of a few primitives, so an implementer only fills in what depends on their representation.
Then, if they want more
With AbstractList, implementing get and size gives a complete, correct unmodifiable list: iteration, contains, indexOf, subList, toString, and the equals and hashCode contract all come from the skeleton, and if you also override set, add and remove at an index, it becomes modifiable.
If an implementer already has a superclass, they can still benefit by implementing the interface and delegating to a private inner class that extends the skeleton, which is sometimes called simulated multiple inheritance. That only works because the type is an interface.
Default methods now cover part of this, and the JDK added several, but they can't hold state, like AbstractList's modCount for fail-fast iterators, and they can't override equals, hashCode or toString, so value contracts still need a class.
I'd use the pattern in my own library for public types that several teams or plug-ins will implement, with a few primitives and many derived operations. For an internal interface with one implementation, I'd skip it and use defaults or a concrete class.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Java 8
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- The Java Language Specification, Java SE 21, Java SE 21 API documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "The JDK often pairs an interface with an abstract skeletal implementation, such as List...": https://scrivio-interview-library.netlify.app/java/interfaces-and-abstract-classes/c789c24f93/