* Use faster stringbuilder for card token formatting instead of full-blown formatter.
* When SN/RN/PN and similar placeholders are expanded, calculate the replacement
value only if the placeholder is present in the string.
In a test with some random games:
55.4M times replaceName was called
39.2M times SN was present
2.0M times PN was present
0.2M times RN was present
0.2M times X was present
* Generate event description on demand, instead on event construction.
In a test with some random games:
71.601M times description is generated
0.258M time it is actually read or used
By postponing generating the description to a point when it is actually needed,
CPU time spent when going through possible actions is reduced to about 80%,
so in given amount of time, MMAB AI and similar
is able to examine larger part of the possible game states.
* Fix typos.
* Remove unnecessary boxing/unboxing.
* Replace traditional 'for' loops with 'foreach' loops.
* Replace explicit types with <> (diamonds) where they can be inferred.
* Collapse identical catch branches.
* Replace statement lambda with expression lambda for short statements.
* Remove unnecessary imports.
* Replace some lambdas with Comparator.comparing
* Replace Runnables with lambdas.
* Use addAll instead of adding whole collection manually.
* Simplify boolean expressions.
* Remove redundant 'else'.
* Simplify some boolean conditions that are always true or false.
* Inline redundant local variables.
* Remove extraneous semicolons.
* Fix Javadoc errors.
* Replace anonymous classes with lambdas.
* Replace chain of 'if's with switch.
* Remove delaration of exception that is never thrown.
* Use String/StringBuilder properly.