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

  • Home
  • SEARCH
  • 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 3661386
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:17:59+00:00 2026-05-19T01:17:59+00:00

Lately I often have to read Java code like this: LinkedHashMap<String, Integer> totals =

  • 0

Lately I often have to read Java code like this:

LinkedHashMap<String, Integer> totals =  new LinkedHashMap<String, Integer>(listOfRows.get(0))
for (LinkedHashMap<String, Integer> row : (ArrayList<LinkedHashMap<String,Integer>>) table.getValue()) {    
    for(Entry<String, Integer> elem : row.entrySet()) {
        String colName=elem.getKey();
        int Value=elem.getValue();
        int oldValue=totals.get(colName);

        int sum = Value + oldValue;
        totals.put(colName, sum);
    }
}

Due to the long and nested type definitions the simple algorithm becomes quite obscured. So I wished I could remove or collapse the type definitions with my IDE to see the Java code without types like:

totals =  new (listOfRows.get(0))
for (row : table.getValue()) {    
    for(elem : row.entrySet()) {
        colName=elem.getKey();
        Value=elem.getValue();
        oldValue=totals.get(colName);

        sum = Value + oldValue;
        totals.put(colName, sum);
    }
}

The best way of course would be to collapse the type definitions, but when moving the mouse over a variable show the type as a tooltip. Is there a Java IDE or a plugin for an IDE that can do this?

  • 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-05-19T01:17:59+00:00Added an answer on May 19, 2026 at 1:17 am

    IntelliJ IDEA will convert the types on the right-hand side of a declaration to <~>. So that:

    Map<Integer, String> m = new HashMap<Integer, String>();
    

    Will appear folded as:

    Map<Integer, String> m = new HashMap<~>();
    

    This is settable via the Editor / Code Folding / Generic Constructor and Method Parameters property and the community edition of the IDE is free.


    Or you could use Scala, which has type inference:

    val totals = new mutable.Map[String, Int]
    for { 
        row <- table.getValue
        (colName, value) <- row.entrySet 
    } totals += (colName -> (value + totals.get(colName) getOrElse 0)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read a lot about the Java class loading process lately. Often I
Lately I have been trying my hands on Eclipse IDE for java development. I
Lately I have been experiencing Eclipse Galileo (3.5) slowing down under Java 1.5b12 OR
We all encounter and hear them more often lately and i'd like some good
Something I have found myself doing often lately is declaring typedefs relevant to a
We get this error in Visual Studio 2005 and TFS very often. Can anyone
Lately I get a very strange error at the following line of code: IO.binwrite(attachmentUploadFile,
I've seen the following often lately and I'm wondering what it does? I can't
Lately, I've often found myself wanting to run some command on the output of
Lately, I have taken to the pattern of having a lot of diagnostic logging

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.