Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8071675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:45:53+00:00 2026-06-05T13:45:53+00:00

This is my very first question on Stackoverflow, so please bear with me if

  • 0

This is my very first question on Stackoverflow, so please bear with me if you find anything nonsensical in my very first post. FYI that I’ve gone through the SO FAQ and I’m aware of its various policies. You see, I’m a guy that has heavily worked with languages such as PHP, Perl, Python, ROR and recently I “context-switched” to Java EE. You see, several of the languages that I’ve worked on had a construct that enabled me to recursively dump the contents of an aggregate structure without a for/foreach/for..in loop

For example,

a = Any composite Data structure 

PHP has

var_dump() and print_r() 

Perl has

Data::Dumper

ROR has

PrettyPrint

and Python has

pprint module

.

So my question goes,

Is there an equivalent of any of these in the Java universe ? I find it very convenient when I used to work in any of these languages (PHP/Perl/Python/ROR) to dump the contents of an composite data-structure to examine how it looks and then process it further (or decide on how to process it further)

Thanks for your time and apologies if my post overlooks any SO rules.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:45:54+00:00Added an answer on June 5, 2026 at 1:45 pm

    The java.util collections have toString() that will recursively dump out the details of the list / set / map etc. This requires that the objects stored in the collection have useful toString()s defined.

    It breaks down for arrays however, because Java doesn’t have a useful default toString() for an array. If you know you’re dealing with an array, then you can use the Arrays.deepToString() utility method (see guido’s response for more detail).

    For example, this code:

    final Map<String, Object> map = new HashMap<String, Object>();
    final List<String> nested = Arrays.asList("foo", "bar", "baz");
    
    map.put("given", "Arthur");
    map.put("family", "Dent");
    map.put("nested", nested);
    
    System.out.println(map);
    

    Produces this:

    {nested=[foo, bar, baz], given=Arthur, family=Dent}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings everyone. This is my first question here at stackoverflow so please bear with
This is a very basic question on Java. I've read somewhere that at first
This is actually my very first question on Stackoverflow. I hope its not the
This is very basic magento question i guess. I want to first get all
This may be a very mundane question, but this is the first jQuery plugin
Sorry if this sounds like a very basic question, it is my first time
I'm new here, and this is my very first post. I have a very
Hello stackoverflow guru's! This is my first post after having used the site for
For Starters, i would like to note, that this is my first post on
I think this could be my first question here in stackoverflow. It's about as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.