void () { List<CharSequence> list = new ArrayList<>(); for (CharSequence charSequence : getListExtends()) { if (charSequence != null) { list.add(charSequence); } } List<? extends CharSequence> res = list; System.out.println(res); }