Java tutorial
//package com.java2s; import android.support.annotation.Nullable; public class Main { public static boolean charsEqual(@Nullable Character one, @Nullable Character another, boolean ignoreCase) { if (ignoreCase) { one = one != null ? Character.toUpperCase(one) : null; another = another != null ? Character.toUpperCase(another) : null; } return !(one != null ? !one.equals(another) : another != null); } }