private static List<Color> appendColor(Color color, List<? extends Color> recentColors, int maxSize) {
      ArrayList<Color> colors = new ArrayList<>(recentColors);
      colors.remove(color);
      colors.add(0, color);

      if (colors.size() > maxSize) {
        colors = new ArrayList<>(recentColors.subList(0, maxSize));
      }
      return colors;
    }
private static List<Color> appendColor(Color color, List<? extends Color> recentColors, int maxSize)