So I am trying to add alphabets or numbers into a list of characters? I do not want to have any spaces or . or , or ? or any other sign. I just want pure numbers and alphabets. Part of my code is as follows:
while((r = br.read()) != -1){
char c = (char) r;
if (!((c == ' ') || (c == ',') || (c == '.') || (c == '?')))
output.add(c);
}
You can see I have added an if statement which checks for spaces or , or . or ? Is there any efficient way to do this? So that I do not have to include all the signs in the statement, hence, making it longer.