Flashcards
Dependency Inversion Principle
Hover (or tap) to flip
High-level modules should depend on abstractions; low-level details should implement those abstractions.
Learn moreISP practical outcome
Hover (or tap) to flip
Clients implement only what they need, reducing coupling and accidental dependencies.
Learn moreInterface Segregation Principle
Hover (or tap) to flip
Prefer several small, specific interfaces over one large general-purpose interface.
Learn moreDefault methods in interfaces
Hover (or tap) to flip
Default methods allow adding behavior to interfaces while keeping backward compatibility.
Learn moreInterface contract
Hover (or tap) to flip
An interface defines capabilities a class promises to provide.
Learn moreWhen to choose an abstract class
Hover (or tap) to flip
When you want shared implementation plus a partial contract across related classes.
Learn moreAbstract method definition
Hover (or tap) to flip
A method without a body that must be implemented by concrete subclasses.
Learn moreInterface vs abstract class choice
Hover (or tap) to flip
Use interfaces for contracts/multiple inheritance of type; use abstract classes for shared code and state.
Learn moreAbstract class role
Hover (or tap) to flip
An abstract class can define shared state/behavior and leave some methods to be implemented by subclasses.
Learn moreWildcard bounds meaning
Hover (or tap) to flip
Use ? extends for reading (producer) and ? super for writing (consumer) where appropriate.
Learn moreGenerics purpose
Hover (or tap) to flip
Generics provide compile-time type safety and reduce the need for explicit casts.
Learn moreAvoiding ClassCastException
Hover (or tap) to flip
Defensive checks and polymorphism-based design reduce the need for casting.
Learn moreSafe type casting approach
Hover (or tap) to flip
Validate the runtime type (e.g., using instanceof) before casting a reference.
Learn moreFactory Method benefit
Hover (or tap) to flip
Reduces coupling to concrete classes and supports extension without modifying client code.
Learn moreFactory Method pattern intent
Hover (or tap) to flip
Defines a creation method in a base type and lets subclasses decide which concrete type to instantiate.
Learn moreCore collection interfaces
Hover (or tap) to flip
List, Set, Queue/Deque, and Map are the main abstractions used across the framework.
Learn moreCollections Framework overview
Hover (or tap) to flip
A unified architecture of interfaces and implementations for storing and manipulating groups of objects.
Learn moreArrayList insert/remove cost
Hover (or tap) to flip
Middle insertions/removals may be O(n) because elements need shifting.
Learn moreArrayList structure
Hover (or tap) to flip
A resizable-array implementation of List with fast random access.
Learn moreLinkedList random access cost
Hover (or tap) to flip