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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:49:29+00:00 2026-06-10T22:49:29+00:00

I have written following lines of code and seems everything is OK, however when

  • 0

I have written following lines of code and seems everything is OK, however when I see result its not correct.

Here, I defined a LinkedList and adding an object into it.

private LinkedList<KategoriRecipeList> createListObjects() {

        LinkedList<KategoriRecipeList> list = new LinkedList<KategoriRecipeList>();
        KategoriRecipeList kategori = new KategoriRecipeList();

        for(int i=0; i<resepi.getResepiId().size(); i++) {
            kategori.setKategoriName(kategoriName);
            kategori.setResepiId(resepi.getResepiId().get(i));
            kategori.setResepiName(resepi.getResepiName().get(i).trim().replaceAll("'", ""));
            kategori.setImgLogoUri(resepi.getResepiImageURL().get(i));
            kategori.setImgMoreUri(bitmapUrls.get(i));

            Log.i("WWWWWWW", "Recipe '" + resepi.getResepiName().get(i) + "' added to list");

            list.add(kategori);
        }

        return list;
    }

When I see Log file the result is like this:

09-09 03:05:29.272: I/WWWWWWW(1250): Recipe '"Chicken Cordon Bleu"' added to list

09-09 03:05:29.272: I/WWWWWWW(1250): Recipe '"Sat-Bag"' added to list

09-09 03:05:29.272: I/WWWWWWW(1250): Recipe 'Ayam Adobo ' added to list

09-09 03:05:29.272: I/WWWWWWW(1250): Recipe 'Ayam Ber’Crumble’ & ‘Fennel’ direneh Air Roselle' added to list

09-09 03:05:29.272: I/WWWWWWW(1250): Recipe 'Ayam Dua Cara' added to list

I have another method which invokes above method:

private void storeListIntoDatabase() {
        Log.i(TAG, "Try to insert data into database.");

        LinkedList<KategoriRecipeList> listOfObjects = createListObjects();
        if(listOfObjects == null  ||  listOfObjects.size() <= 0)
            return;

        for(int i=0;  i<listOfObjects.size(); i++)
            Log.i("KKKKKKKK", "Recipe '" + listOfObjects.get(i).getResepiName() + "' added to list");
    }

Result in log file is like this:

09-09 03:05:29.297: I/KKKKKKKK(1250): Recipe 'Tongkeng Ayam Goreng dan Nasi Kari Leher Ayam' added to list

09-09 03:05:29.297: I/KKKKKKKK(1250): Recipe 'Tongkeng Ayam Goreng dan Nasi Kari Leher Ayam' added to list

09-09 03:05:29.297: I/KKKKKKKK(1250): Recipe 'Tongkeng Ayam Goreng dan Nasi Kari Leher Ayam' added to list

09-09 03:05:29.297: I/KKKKKKKK(1250): Recipe 'Tongkeng Ayam Goreng dan Nasi Kari Leher Ayam' added to list

09-09 03:05:29.297: I/KKKKKKKK(1250): Recipe 'Tongkeng Ayam Goreng dan Nasi Kari Leher Ayam' added to list

As you can see results are different but i expect result should be same. Where is my problem? Thanks

  • 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-10T22:49:30+00:00Added an answer on June 10, 2026 at 10:49 pm

    this line

    KategoriRecipeList kategori = new KategoriRecipeList();

    needs to be inside the for loop
    you have to create a new object every time

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

Sidebar

Related Questions

I have written following code to attach gesture recogniser to multiple imageviews. [imageview1 setUserInteractionEnabled:YES];
I am trying my hands on WPF MVVM. I have written following code in
i have written the following code class Program { static void Main(string[] args) {
I have written the following code, CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); report.Load(@C:\Users\XXX\Desktop\Backup1\Project\ReportsFolder\ReportSalesInvoice.rpt); Report works
I have written a following code to get just the file name without extension
I have written the following code choice /m Do you want to add another
I have the following segment of code that someone else has written, and that
I have written the following algorithm in order to evaluate a function in MatLab
I have written the following query, but in the WHERE clause I have used
I have written the following constraint for a column I've called 'grade': CONSTRAINT gradeRule

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.