Flashcards
Fix DateTimeParseException
Hover (or tap) to flip
Use the correct formatter pattern and locale, and trim/normalize input before parsing.
Learn moreDateTimeParseException meaning
Hover (or tap) to flip
Thrown when parsing a date/time string fails because the text doesn’t match the expected pattern.
Learn moreAvoid date/time invalid values
Hover (or tap) to flip
Validate inputs and use appropriate java.time types (LocalDate, ZonedDateTime) for the task.
Learn moreDateTimeException meaning
Hover (or tap) to flip
Indicates an invalid date/time operation such as out-of-range values or invalid conversions.
Learn moreSafe removal during Collection iteration
Hover (or tap) to flip
Use Iterator.remove(), collect items to remove later, or use concurrent collections when needed.
Learn moreConcurrentModificationException meaning
Hover (or tap) to flip
Thrown when a collection is structurally modified while iterating (typical with fail-fast iterators).
Learn moreSafe Date/Time parsing approach
Hover (or tap) to flip
Validate input, handle exceptions, and prefer parsing with known locale/format when relevant.
Learn moreNumberFormatException definition
Hover (or tap) to flip
Occurs when parsing a string into a number fails due to invalid characters or format.
Learn moreBigDecimal comparison rule
Hover (or tap) to flip
Use compareTo() for numeric comparison; equals() also compares scale.
Learn moreBigDecimal purpose
Hover (or tap) to flip
BigDecimal supports precise decimal arithmetic and avoids floating-point rounding issues.
Learn morePrevent ClassCastException
Hover (or tap) to flip
Use instanceof checks or redesign APIs to rely on polymorphism instead of casting.
Learn moreClassCastException definition
Hover (or tap) to flip
Thrown when you cast an object to an incompatible type at runtime.
Learn moreRecord use case
Hover (or tap) to flip
Use records for DTOs and simple value objects where immutability and brevity matter.
Learn moreJava record definition
Hover (or tap) to flip
A record is a concise immutable data carrier with auto-generated constructor, accessors, equals, hashCode, and toString.
Learn moreRole of permits keyword for sealed classes
Hover (or tap) to flip
The permits clause explicitly lists allowed subclasses, enabling safer modeling and switches.
Learn moreSealed class definition
Hover (or tap) to flip
A sealed class restricts which subclasses can extend it, declared with permits.
Learn moreWildcard import threshold in IntelliJ
Hover (or tap) to flip
IntelliJ switches to * imports after a threshold; lowering it or disabling prevents wildcard imports.
Learn moreDisable wildcard imports (IntelliJ)
Hover (or tap) to flip
Configure code style to use explicit imports to improve readability and reduce ambiguity.
Learn moreMockito: Matcher consistency rule
Hover (or tap) to flip
If you use a matcher for one argument, use matchers for all arguments in that method call.
Learn moreInvalidUseOfMatchersException meaning
Hover (or tap) to flip