Skip to content

Instantly share code, notes, and snippets.

@amuino
Created July 19, 2011 17:36
Show Gist options
  • Save amuino/1093206 to your computer and use it in GitHub Desktop.
Save amuino/1093206 to your computer and use it in GitHub Desktop.
The wrong mindset
int numberOfThingsThatAreSorted = getCustomComparatorNumberOfKnownThingsForSorting();
int numberOfActualThings = getAllThings().size();
if (numberOfThingsThatAreSorted < numberOfActualThings)
throw new IllegalStateException(
"An implementation of ThisClass (whose abstract subclasses are ThatOtherClass and YetAnotherClass) "
+ "must ensure that all the Things it specifies are also passed in for custom sorting. Instead found only "
+ numberOfThingsThatAreSorted
+ " Things to be sorted, as implemented by getCustomComparatorNumberOfKnownThingsForSorting, but "
+ numberOfActualThings + " actual Things.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment