ciao a tutti come posso rifattorizzare questi metodi con gli stream di java? grazie mille
codice:
public static String reverse(String str) {

  ArrayList<Character> list = new ArrayList<>();

  for (int i = 0; i < str.length(); i++) {
    if (Character.isAlphabetic(str.charAt(i))) {
      list.add(str.charAt(i));
    }
  }
  Collections.reverse(list);

  Iterator<Character> iterator = list.iterator();
  String result = "";

  for (int i = 0; i < str.length(); i++) {
    if (Character.isAlphabetic(str.charAt(i))) {
      result = result + iterator.next();
    }
    if (Character.isDigit(str.charAt(i))) {
      result = result + str.charAt(i);
    }
  }

  return result;
}

//////////////////////////////////////////////////////


public static boolean doubleLetters(String word) {
    for (int i = 0; i < word.length()-1; i++){
        if (word.charAt(i) == word.charAt(i+1)){
            return true;
        }
    }  return false;
}

////////////////////////////////////////////////////


public static String indexShuffle(String str) {
  String odd = "";
  String even = "";
  int count = 0;
  for (char i : str.toCharArray()) {
    if (count % 2 == 0) {
      even += str.charAt(count);
    } else {
      odd += str.charAt(count);
    }
    count++;
  }
  return even + odd;
}