This example will show how to filter a map by keys creating a submap in groovy. First initializing a map of months then calling map.submap() returning months contained in the first quarter. A comparable example demonstrates how to get a subset of a map in java java, java 8 and guava.