I have the below code to implement the requirement, but couldn't solve using stream , I'm not sure how to increment i in pipeline
String[] str = {"a","b","c","d","e","f"};
Map<String, String> strMap = new HashMap<>();
int i = 0;
while(i< str.length && i +1 < str.length) {
strMap.put(str[i],str[i+1]);
i +=2;
}