The Deck of Cards Kata is an advanced kata which can help developers become familiar with multiple Java Collections Frameworks and multiple programming languages. The Kata is based on the Collections.compare(JDK; Apache; Eclipse; Guava...) talk from the Devoxx US 2017 conference.
The domain for the kata is Deck of Playing Cards. There are three
classes that are shared by all of the exercises. These are
Rank
,
Suit
and
Card
.
There are two sets of implementations for the
DeckOfCards with stubs provided for each of the Java Collections
frameworks. The implementations that can be worked on are building
a DeckOfCards using an ImmutableSortedList
or using an ImmutableSortedSet
.
Six Java Collections frameworks are currently available to learn in the kata. They are:
- Java Collections + Streams
- Apache Commons Collections 4.4
- Google Guava 31.1.1-jre
- Eclipse Collections 11.1.0
- Vavr 0.10.4
- Custom Collections Framework (Uses features from Project Amber)
There are two classes which are fully implemented and which have passing tests. They are:
The JDK imperative deck of cards is used as the control subject in the tests for each of the other frameworks. There are TODOs in each class that must be completed in order for a test to pass.
- Refactor the imperative code in
Card
that calculates the cartesian product ofRank
andSuit
.- Replace the code with Java Streams - Look to use
flatMap
andmap
.
- Replace the code with Java Streams - Look to use
- Choose whether you could like to solve the kata using an
ImmutableSortedList
or anImmutableSortedSet
.ImmutableSortedList
TestsImmutableSortedSet
Tests
- Choose the framework(s) you would like to complete the kata with.
- Fix the failing tests for each framework.
- Follow the TODOs and hints in each of the frameworks
DeckOfCards
domain class and test. - Repeat as necessary.