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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:50:51+00:00 2026-05-18T19:50:51+00:00

Ok so heres what I need to do. I’ve got a file that contains

  • 0

Ok so heres what I need to do. I’ve got a file that contains the Names of Categories and is called “categories.txt” then I have files which are the Names of the categories, e.g “Mail.txt”,”News.txt” etc, and those files contain link names such as “Hotmail” and “BBC News”. Now what i’m looking to do is to count the number of links in each category which I can do by putting the contents of each category into an array and then finding the size of it. But after that I need to display the categories from the one with the most links to the one with the least. I’m not sure how to go about this at all, so any help would be greatly appreciated.


I now have this so far to change the position of the categories in the arraylist depending on the size of the file. However it seems to throw an error at the end of the code after the first change has taken place. Any ideas why?

    Iterator itty = parts.iterator();
    int i = -1;
    int count = 0;
    int tempCount = 0;
    String tempName = "";
    while (itty.hasNext()){
        i++;
        catName = parts.get(i).toString();
        PARTS addMenu = new PARTS("" + catName);
        count = addMenu.links().size();
        if (i > 0){
            if (tempCount < count){
                int ind = parts.indexOf(catName);
                parts.remove(tempName);
                parts.add(ind,tempName);
                System.out.print(parts.toString());
            }
        }
        tempCount = count;
        tempName = catName;
        itty.next();
    }
  • 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-18T19:50:51+00:00Added an answer on May 18, 2026 at 7:50 pm

    1. Read the categories.txt file , read one category say for example news now try opening news.txt and count the no of records inside the news.txt update map accordingly.

    Map<String,Long> 
    

    2. To hold link for each category use

    Map<String,List<String>> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, so heres what I need to learn. I have 2 java programs that
I have 700 files in a single folder. I need to find files that
here i need a batch file which can apply and create label or base
Here's what I need to fetch: - posts that have comments - number of
Alright, so heres my problem: I have an application I am working with that
OK, so here what I need. I have an if statement that if it
heres a quick one for you: I have a list of id's which I
I need to consume a service that takes a GET parameter named names[]. For
I need to uncomment a portion of xml in a file that I am
i am working on a project that need to upload files from iphone to

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.