java中如何去掉字符串数组里面空格

String[] aa = {"","","ddd","","asdf" };
        List<String> tmp = new ArrayList<String>();
        for(String str:aa){
            if(str!=null && str.length()!=0){
                tmp.add(str);
            }
        }
        aa = tmp.toArray(new String[0]);


你可能感兴趣的:(java,String,null)