Welcome to the Ranch
Well done telling us where
that code comes from; don't take the blame for it yourself

.
I think you should probably not declare Streams; they are not usually used twice (indeed sometimes cannot be used twice), so it is usually a waste of time to declare them. Assuming that wordStream is created from a List<String>, your code would go something like this:-
Line 1: You start off with the
List.stream() method (or more precisely, Collection#stream() because that method is defined in Collection). Since you have a List<String> the stream method returns a
Stream<String>, so it will go through all the names of the languages in turn. Or more precisely, it will go through the languages when the last method call runs because Streams use lazy execution exclusively. If you add line 1½
.peek(System.out::println)
and line 2½ which will look exactly the same, and if I haven't misled you with incorrect code, you will probably see that; you get
java 4 php 3, not java php 4 3.
Line 2 creates an IntStream. It is as you know an intermediate operation because it takes one sort of Stream and creates a different sort of Stream. Line 3 returns an
int; since that is different from a Stream, that is called a terminal operation. Anyway, back to line 2. The
mapToInt method creates an
IntStream. You doubtless already know there are four kinds of Stream: Int Long Double and <T>. The mapToInt method needs a
ToIntFunction of type String→
int. Now, as you can see ToIntFunction is a functional interface, so you can use a
λ expression instead of an anonymous class, and all you need is something which goes from the object being handled by the Stream at present which I called
s, to an
int; they are using the String's length() method. So you write s on the left, s.length() on the right and the arrow token in the middle:-
s -> s.length()
Since you are using a simple method call on the object in question, you can write the reference and method name and hardly anything else:-
s::length
instead. Note the :: and that the () are omitted. Now that returns an
int, 4 from java, 3 from php, etc, which by the way seems to add up to 24.
Your
reduce call in line 3 is a terminal function, taking an
int called identity as its first parameter. Look on that as a starting value; you are passing 0, but if you passed −24, you would have got 0 as your final result. The second parameter is an
IntBinaryOperator which takes two arguments; one of them will be the value of
identity and the other will be the value of whichever
int comes next in your Stream. It calls them
x and
y only I changed that to
i and
j, and adds them. Go through the links I provided; I think that to reduce is particularly helpful. It says that the operation must be associative, which means you don't have to provide the arguments in any particular order, so + is permissible but ÷ and − won't work; remember that
i − j ≠ j − i.
So that method returns the total, and you assign it to some
int value and print it out. If you count the letters in those language names, they add up to 24.
I think there is a much simpler way to write that expression:-
I presume the awkward‑looking last line is intended to show you how to use the IntBinaryOperator.