code: private static Map<ColorRgba, Collection<TileRef>> convertToColorKey(Map<TileRef, ColorRgba> tiles)
      {
          final Map<ColorRgba, Collection<TileRef>> colors = new HashMap<>();
  
          for (final Map.Entry<TileRef, ColorRgba> entry : tiles.entrySet())
          {
              final Collection<TileRef> tilesRef = getTiles(colors, entry.getValue());
              tilesRef.add(entry.getKey());
          }
  
          return colors;
      }
docs: Convert map associating color per tile to tiles per color.
  
  @param tiles The tiles data (must not be <code>null</code>).
  @return The map with color as key.