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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:15:35+00:00 2026-06-13T10:15:35+00:00

I am getting really tired from this problem, and I do not know what

  • 0

I am getting really tired from this problem, and I do not know what to do.

import ... 
class ...

private ArrayList <Operation> operationList = new ArrayList<Operation>();

@Override
public Collection<String> lineList() {
    Set <String> groupOperation = new HashSet<String>();
    Operace newOperation= null;

    LogFileReader reader = new LogFileReader(nameFile);
    LogEntry line = reader.nextLine();

    while(reader.existsLine()) {
        for(Operation whatever2: operationList) {
            if(line.getOperation().equals(whatever2.getName())) {
                whatever2.setAmmount(whatever2.getAmmount()+1);
                line = reader.nextLine();
            }
        }
        newOperation = new Operation(line.getOperation());
        newOperation.setAmmount(1);
        groupOperation .add(newOperation);
        line = reader.nextLine();
    }
    ....
    return groupOperation;
}
  • The problem is in while WITH FOR(x y: z) IF (), other things
    work.
  • (If i will delete whole FOR, it seems, that it works, but I need counting.)

  • IN THE CLASS OPERATION IS ONLY GETTER AND SETTER for “name” and “ammount”.

    1. Explanation
    2. I read a file.
    3. I read only topic from a file.
    4. I load that like a Operation(name = title, ammount = how many times is the same in file)
    5. I give it to ArrayList = IT DOESNT WORK VERY WELL !!!
    6. From ArrayList to Set, thats to interface.
    7. Interface to GUI.

EDIT1: “Exception in thread “AWT-EventQueue-0″ java.lang.NullPointerException”

I hope anyone will understand,

Thanks to everybody,

MmM …

  • 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-13T10:15:36+00:00Added an answer on June 13, 2026 at 10:15 am

    In your for loop, you have this line:

          line = reader.nextLine();
    

    This doesn’t have any check on line existence as you have done in while condition -> reader.existsLine(). This makes it to read the lines and may fail here or last statement in the while, if there are no more lines to read.

    I am not sure, you really want to read the line within the for loop. if yes, wrap in the if condition as:

           if(reader.existsLine()){
              line = reader.nextLine();
           }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting this error and I really dont know why. I have tried
I'm getting a really strange NPE exception. This is the offending code: private static
I'm not really getting how this code does what it does: char shellcode[] =
I'm getting really tired of trying to figure out why this code works in
I've tried looking up other help for this problem but I'm just not getting
I am getting really confused with this concept: If I want to implement a
This is really getting to me now.I have a form that loads when the
Sorry if this is a really basic question but it's been really getting to
I dont know what to do anymore... its hopeless. I'm getting tired of guessing
I'm showing the code to this problem for example purposes, but really my question

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.