java.util.stream.ReferencePipeline$3@396555a1

is the outcome of trying to print the Stream you have created until the map operation performed.

You are looking to collect the user names mapped until now while joining then with a \n delimiter.

String users = memberNames.stream()
        .map(user -> String.format("The user name is %s and his lastname is %s", user.name, user.lastname))
        .collect(Collectors.joining("\n"));
System.out.println(users); // to print them all at once
Answer from Naman on Stack Overflow
🌐
Medium
medium.com › @Sohjiro › working-with-streams-and-optionals-in-java-8-pt-2-f4d655dcea51
Working with Streams and Optionals in Java 8… pt 2 | by Felipe Juárez | Medium
October 17, 2017 - The task saids, that every null value should be converted into an empty string. With this behaviour, we are breaking one the criteria for this task. That’s why filter isn’t a good choice for this operation, because we need to preserve the complete data and change “corrupted” values. So let’s try again with a map function to see what happens: ... Exception in thread "main" java.lang.NullPointerException at Reader.lambda$convertRow$1(Reader.java:29) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Spliterators$ArraySpliterator.forEachRemaining(S
Discussions

java streams java.util.stream.ReferencePipeline$3@7291c18f - Stack Overflow
I have three layers and I want to reach students names using streams from Project. I can reach them from Group. How could I do that from Project. public class Student { private Integer id; More on stackoverflow.com
🌐 stackoverflow.com
dictionary - Most elegant way to join a Map to a String in Java 8 - Stack Overflow
I love Guava, and I'll continue to use Guava a lot. But, where it makes sense, I try to use the "new stuff" in Java 8 instead. "Problem" Lets say I want to join url attributes in a String. In Gua... More on stackoverflow.com
🌐 stackoverflow.com
Converting Stream to a List of user defined object
Your bottom code looks correct to me, you probably just need to import the Collectors class correctly. More on reddit.com
🌐 r/javahelp
2
1
April 23, 2021
Why does my Clojure implementation of Conway's Game of Life run so much slower than my Java implementation?
You're using boxed math operations, which are about 100x slower than primitive ops. With some ^long type hints and a few minor modifications, and maybe a `(set! *unchecked-math* true)`, it should be similar. More on reddit.com
🌐 r/Clojure
38
32
May 3, 2020
🌐
Medium
medium.com › @anil.goyal0057 › the-ultimate-guide-to-java-streams-for-interviews-0da819bd8545
The Ultimate Guide to Java Streams for Interviews | by Anil Goyal | Medium
August 21, 2025 - Common functional interfaces are in the java.util.function package. Streams are built around functional programming concepts. Most stream operations accept functional interfaces as parameters: ... // functional interface as lambda expression example // Predicate in streams List<String> namesList = Arrays.asList("Alice", "Bob", "Charlie", "David"); long count = namesList.stream() .filter(name -> name.startsWith("A")) .count(); // Function in streams List<String> upperCaseNames = namesList.stream() .map(name -> name.toUpperCase()) .toList(); // Consumer in streams namesList.stream() .forEach(name -> System.out.println("Hello, " + name + "!")); // Supplier in streams simple example orElseGet Optional<String> optionalName = Optional.ofNullable(null); String nameOrDefault = optionalName.orElseGet(() -> "Default Name"); System.out.println(nameOrDefault); // Output: Default Name
🌐
InfoWorld
infoworld.com › home › software development › programming languages › java
Java Stream API tutorial: How to create and use Java streams | InfoWorld
November 13, 2025 - List<List<String>> nested = List.of( List.of("james", "bill"), List.of("patrick") ); nested.stream() .map(list -> list.stream()) .forEach(System.out::println); The output here will be: java.util.stream.ReferencePipeline$Head@5ca881b5 java.util.stream.ReferencePipeline$Head@24d46ca6 ·
🌐
GitHub
github.com › openjdk › jdk › blob › master › src › java.base › share › classes › java › util › stream › ReferencePipeline.java
jdk/src/java.base/share/classes/java/util/stream/ReferencePipeline.java at master · openjdk/jdk
import java.util.function.ToLongFunction; import jdk.internal.access.SharedSecrets; · /** * Abstract base class for an intermediate pipeline stage or pipeline source · * stage implementing whose elements are of type {@code U}. * * @param <P_IN> type of elements in the upstream source · * @param <P_OUT> type of elements in produced by this stage · * * @since 1.8 · */ abstract class ReferencePipeline<P_IN, P_OUT> extends AbstractPipeline<P_IN, P_OUT, Stream<P_OUT>> implements Stream<P_OUT> { ·
Author: openjdk
🌐
Azalio
azalio.io › home › java stream api tutorial: how to create and use java streams
Java Stream API tutorial: How to create and use Java streams - Azalio
November 13, 2025 - java.util.stream.ReferencePipeline$Head@5ca881b5 java.util.stream.ReferencePipeline$Head@24d46ca6 · There are two lines because there are two inner lists, so you need two Stream objects. Also note that hash values will vary. Here is the same stream with flatMap(): nested.stream() .flatMap(List::stream) .forEach(System.out::println); In this case, the output will be: james bill patrick ·
🌐
Itsallbinary
itsallbinary.com › javadoc-examples › java › docs › api › examples › java › util › stream › java.util.stream.Stream.html
Stream Guide | Usage, Javadoc, Examples for all methods
Causes NullPointerException List<String> namesWithR2 = Stream.of(new String[] { "Tom", null, "Amy", null, "Remi" }) .filter(n -> n.startsWith("R")).collect(Collectors.toList()); System.out.println("Names starting with 'R' = " + namesWithR2); Output: Names starting with 'R' = [Ravi, Richard, Remi] java.lang.NullPointerException at com.itsallbinary.javadocexamples.examples.java_util_stream.StreamExamples.lambda$73(StreamExamples.java:825) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176) at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Sp
Find elsewhere
Top answer
1 of 2
84

You can grab the stream of the map's entry set, then map each entry to the string representation you want, joining them in a single string using Collectors.joining(CharSequence delimiter).

import static java.util.stream.Collectors.joining;

String s = attributes.entrySet()
                     .stream()
                     .map(e -> e.getKey()+"="+e.getValue())
                     .collect(joining("&"));

But since the entry's toString() already output its content in the format key=value, you can call its toString method directly:

String s = attributes.entrySet()
                     .stream()
                     .map(Object::toString)
                     .collect(joining("&"));
2 of 2
3
 public static void main(String[] args) {


        HashMap<String,Integer> newPhoneBook = new HashMap(){{
            putIfAbsent("Arpan",80186787);
            putIfAbsent("Sanjay",80186788);
            putIfAbsent("Kiran",80186789);
            putIfAbsent("Pranjay",80186790);
            putIfAbsent("Jaiparkash",80186791);
            putIfAbsent("Maya",80186792);
            putIfAbsent("Rythem",80186793);
            putIfAbsent("Preeti",80186794);

        }};


        /**Compining Key and Value pairs and then separate each pair by some delimiter and the add prefix and Suffix*/
        String keyValueCombinedString = newPhoneBook.entrySet().stream().
                // you can improve the performance by avoiding "+"
                // "map(entrySet -> "%s:%s".formatted(entrySet.getKey(), entrySet.getValue())."
                map(entrySet -> entrySet.getKey() + ":"+ entrySet.getValue()).
                collect(Collectors.joining("," , "[","]"));
        System.out.println(keyValueCombinedString);

        /**
         *  OUTPUT : [Kiran:80186789,Arpan:80186787,Pranjay:80186790,Jaiparkash:80186791,Maya:80186792,Sanjay:80186788,Preeti:80186794,Rythem:80186793]
         *
         * */


        String keyValueCombinedString1 = newPhoneBook.entrySet().stream().
                map(Objects::toString).
                collect(Collectors.joining("," , "[","]"));
        System.out.println(keyValueCombinedString1);

        /**
         * Objects::toString method concate key and value pairs by =
         * OUTPUT : [Kiran=80186789,Arpan=80186787,Pranjay=80186790,Jaiparkash=80186791,Maya=80186792,Sanjay=80186788,Preeti=80186794,Rythem=80186793]
         * */

    }

> Blockquote
🌐
Reddit
reddit.com › r/javahelp › converting stream to a list of user defined object
r/javahelp on Reddit: Converting Stream to a List of user defined object
April 23, 2021 -

Hello, I'm new to this, please bear with me. I have a List of user defined objects like this:

List<User> users;

Along the way I'll be populating users, after that I'll be filtering it as well. What I did first for filtering was this:

users = users.stream().filter(u -> u.name.equals(otherName))

But I got an error like this: Cannot cast object 'java.util.stream.ReferencePipeline$2@7c3e47d3' with class 'java.util.stream.ReferencePipeline$2' to class 'java.util.List', so I changed the code to this:

users = users.stream().filter(u -> u.name.equals(otherName))
                      .collect(Collectors.toList())

But I got another error that goes something like this:

No such property: Collectors for class: com.users.graphql.$UserServiceDefinition$Intercepted

What can I do to successfully convert stream to a List<User>? I hope you can help, thanks!

EDIT :

I'm using groovy so I should've used the filter for groovy like this:

users = users.findAll{ it.name.equals(otherName) }

Top answer
1 of 2
2
Your bottom code looks correct to me, you probably just need to import the Collectors class correctly.
2 of 2
1
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
🌐
Coderanch
coderanch.com › t › 710978 › java › stream-produced-intermediate-operation
What is inside the stream produced by an intermediate operation? (Features new in Java 8 forum at Coderanch)
There are several package‑private classes in the java.util.stream package which implement the various interfaces, and that is one of them. I don't know ay more detaills; I don't think that I need to know anything. ... Remember in your other threads about this topic that I gave an example implementation called StreamImpl? ReferencePipeline is the name that Oracle gave to the Stream implementation.
🌐
OpenJDK
cr.openjdk.org › ~briangoetz › JDK-8011920 › webrev › src › share › classes › java › util › stream › ReferencePipeline.java.html
New src/share/classes/java/util/stream/ReferencePipeline.java
64 * 65 * @param source {@code Supplier<Spliterator>} describing the stream source 66 * @param sourceFlags The source flags for the stream source, described in 67 * {@link StreamOpFlag} 68 * @param parallel True if the pipeline is parallel 69 */ 70 ReferencePipeline(Supplier<? extends Spliterator<?>> source, 71 int sourceFlags, boolean parallel) { 72 super(source, sourceFlags, parallel); 73 } 74 75 /** 76 * Constructor for the head of a stream pipeline.
🌐
Kony
docs.kony.com › NativeAPIs › Android › java.util.stream-Android-10.0 › index.html
java.util.stream.ReferencePipeline - Documentation - Android
java.util.stream.ReferencePipeline · java.util.stream.Sink · java.util.stream.Sink.ChainedDouble · java.util.stream.Sink.ChainedInt · java.util.stream.Sink.ChainedLong · java.util.stream.Sink.ChainedReference · java.util.stream.SliceSpliteratorTest · java.util.stream.SpinedBuffer ·
🌐
Openjdk
hg.openjdk.org › jdk8 › jdk8 › jdk › file › 687fd7c7986d › src › share › classes › java › util › stream › ReferencePipeline.java
jdk8/jdk8/jdk: 687fd7c7986d src/share/classes/java/util/stream/ReferencePipeline.java
* * @param source {@code Supplier<Spliterator>} describing the stream source * @param sourceFlags the source flags for the stream source, described in * {@link StreamOpFlag} * @param parallel {@code true} if the pipeline is parallel */ ReferencePipeline(Supplier<? extends Spliterator<?>> source, int sourceFlags, boolean parallel) { super(source, sourceFlags, parallel); } /** * Constructor for the head of a stream pipeline.
🌐
Medium
medium.com › @himani.prasad016 › java-8-stream-api-ef7a2fee1b4b
Java 8 Stream API. Java 8 introduced several new features… | by Himani Prasad | Medium
November 5, 2023 - List<String> myList = Arrays.asList("apple", "banana", "cherry", "date", "strawberry", "orange", "blueberry"); Stream<String> myStream = myList.stream(); System.out.println(myStream); It prints out the reference to the ReferencePipeline$Head ...
🌐
GitHub
github.com › JetBrains › jdk8u_jdk › blob › master › src › share › classes › java › util › stream › ReferencePipeline.java
jdk8u_jdk/src/share/classes/java/util/stream/ReferencePipeline.java at master · JetBrains/jdk8u_jdk
import java.util.function.ToLongFunction; · /** * Abstract base class for an intermediate pipeline stage or pipeline source · * stage implementing whose elements are of type {@code U}. * * @param <P_IN> type of elements in the upstream source · * @param <P_OUT> type of elements in produced by this stage · * * @since 1.8 · */ abstract class ReferencePipeline<P_IN, P_OUT> extends AbstractPipeline<P_IN, P_OUT, Stream<P_OUT>> implements Stream<P_OUT> { ·
Author: JetBrains
🌐
GitHub
github.com › AdoptOpenJDK › openjdk-jdk11 › blob › master › src › java.base › share › classes › java › util › stream › ReferencePipeline.java
openjdk-jdk11/src/java.base/share/classes/java/util/stream/ReferencePipeline.java at master · AdoptOpenJDK/openjdk-jdk11
March 2, 2019 - import java.util.function.ToLongFunction; · /** * Abstract base class for an intermediate pipeline stage or pipeline source · * stage implementing whose elements are of type {@code U}. * * @param <P_IN> type of elements in the upstream source · * @param <P_OUT> type of elements in produced by this stage · * * @since 1.8 · */ abstract class ReferencePipeline<P_IN, P_OUT> extends AbstractPipeline<P_IN, P_OUT, Stream<P_OUT>> implements Stream<P_OUT> { ·
Author: AdoptOpenJDK
🌐
Javadoc.io
javadoc.io › doc › com.speedment › speedment › 2.0.0-EA › com › speedment › util › stream › builder › pipeline › ReferencePipeline.html
ReferencePipeline - speedment 2.0.0-EA javadoc
Bookmarks · Latest version of com.speedment:speedment · https://javadoc.io/doc/com.speedment/speedment · Current version 2.0.0-EA · https://javadoc.io/doc/com.speedment/speedment/2.0.0-EA · package-list path (used for javadoc generation -link option) · https://javadoc.io/doc/com.spee...