I have an ArrayList filled with objects of the class Result. Every Result has an attribute named Category.
I am trying to make method with a for-loop which prints out every result with the input Category from the user.
Currently the for-loop works but the if-statement which separates whether or not to print out a result doesnt work and that is what Im searching help for.
The if statement standing alone is what I think is not working at the moment since ive tried all the other code.
String categoryToPrint;
    System.out.println("Which category would you like to print out results for?");
    categoryToPrint = scanner.nextLine();
    categoryToPrint = normalisera(grenAttVisa); //method making all letters small and first letter capital.
    System.out.println("Resultlist for" + categoryToPrint );
    for (int i = 0; i < resultlist.size(); i++) {
        Athlete matched = null;
        Result res = resultlist.get(i);
        if (res.categoryName().equals(categoryToPrint)) {
        for (int x = 0; x < resultlist.size(); x++) {
            Athlete del = athletes.get(x);
            if (res.athleteStartNumber() == del.startNumber()) {
                matched = del;
                break;
            }
        }
        System.out.println(matched.surName() + " " + matched.lastName() + " has the result: " + res.categoryValue());
    }
    }
 
    