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 8708013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:00:43+00:00 2026-06-13T04:00:43+00:00

I am trying to apply transform to List <Map <String, String>> . Is it

  • 0

I am trying to apply “transform” to List <Map <String, String>>. Is it possible in the “Function.apply” method to get the index of the current item in the List?

Lists.transform(data, new Function<Map<String, String>, Map<String, String>>() {
        private static int index = 0;

        @Override
        public Map<String, String> apply(Map<String, String> from) {
            from.put(key, value); // need to get index
            return from;
        }
    });
  • 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-13T04:00:44+00:00Added an answer on June 13, 2026 at 4:00 am

    Often in Java, using a loop is much simpler and cleaner.

    List<Map<String, String>> data = ...
    for(int i = 0; i < data.size(); i++) {
        // i is the index.
        data.get(i).put(key, value);
    }
    

    I should say that I am in favour of functional programming in a language which supports it. Java 7 is not well suited for functional programming and sometimes you have to resort to iteration. Java 8 and 9 promises to be more functional programming friendly with the addition of closures.

    IMHO Java doesn’t even support recursion as well as many languages do. A lack of tail call elimination in the JVM is a deficiency.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to apply a transformation to an mpl::string , but can't get it
im trying to apply this JSON code to my Google Map: [ { stylers:
I am trying to apply smoothing filter to image . But I get this
I'm trying to apply a transform to my msi file. I've created the transform
I'm trying to run apply a function to each row of a dataset. The
I'm trying to apply a transform with java ( currentXSLT.transform(xmlFile, outputFile); ) But I'm
I'm trying to apply the C14N transform to some generated XML. It appears I
I am trying to apply a transform to an HTML file. The transform works
I'm trying to apply a transform to a 3D object in a STL File
When trying to apply a CSS transform with perspective I encounter a weird glitch

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.