I'm looking to replace the following for loop with an elegant java 8 stream or lambda solution. Is there anything concise and efficient?
public static void main(String[] args) {
ArrayList<Integer> myList = new ArrayList<>( Arrays.asList( 10,-3,5));
// add 1/2 of previous element to each element
for(int i =1 ;i < myList.size(); ++i )
myList.set(i, myList.get(i)+myList.get(i-1)/2);
// myList.skip(1).forEach( e -> e + prevE/2 ); // looking for something in this spirit
}
replaceAllmethod