/* ============================================================================
 * Copyright (c) 2015 Imagic Bildverarbeitung AG, CH-8152 Glattbrugg.
 * All rights reserved.
 *
 * http://www.imagic.ch/
 * ============================================================================
 */
package algorithm.string;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 *
 * @version $Revision$
 * @version $Date$
 * @author $Author$
 * @owner Sandro Mario Zbinden
 */
public class GameofThronesI {
    public static class Solution {

        public static boolean isAnagramAPalindrom(String input) {
            Map<Character, Boolean> letterMap = new HashMap<>();
            for (int i = 0; i < input.length(); i++) {
                char currentChar = input.charAt(i);
                if (letterMap.containsKey(currentChar)) {
                    letterMap.put(currentChar, !letterMap.get(currentChar));
                } else {
                    letterMap.put(currentChar, false);
                }
            }
            if (letterMap.values().stream().filter(b -> b == false).count() > 1) {
                return false;
            } else {
                return true;
            }
        }

        public static void main(String[] args) {
            try (Scanner in = new Scanner(System.in)) {
                if (isAnagramAPalindrom(in.nextLine())) {
                    System.out.println("YES");
                } else {
                    System.out.println("NO");
                }
            }
        }
    }

    public static void main(String[] args) {
        Solution.main(null);
    }
}

@@ -824,36 +824,32 @@
                 
-if (
 letterMap.contai
@@ -848,171 +848,92 @@
 p.co
-ntainsKey(currentChar)) %7B%0D%0A                    letterMap.put(currentChar, !letterMap.get(currentChar));%0D%0A                %7D else %7B%0D%0A                    letterMap.pu
+mputeIfPresent(currentChar, (k, v) -%3E !v);%0D%0A                letterMap.computeIfAbsen
 t(cu
@@ -942,16 +942,21 @@
 entChar,
+ k -%3E
  false);
@@ -957,35 +957,16 @@
 alse);%0D%0A
-                %7D%0D%0A
         

Refactor if's that check if a key is present in a map and use the new java 8 method computeIfPresent and computeIfAbsent