Ok heres the problem Im working on a final project for a java course and one thing is blocking my path.

import java.util.*;

public class Controller {
  public List<CrewMember> list = new ArrayList<CrewMember>();

  public void addItem() {    
    CrewMember cm = Academy.load(
      MenuUtil.getAString("Enter the role: "), 
        MenuUtil.getAnInt("Enter the id number: "));
    if(cm!=null) list.add(cm);
    else System.out.println("Load Failed; nothing to add");

  public void removeItem() {
    int i = (
      MenuUtil.getAnInt("Choose the crew member you wish to remove '0' being first in the list: "));

  public void displayItems () {
    for(CrewMember item : list ) {

  public void display(String s) {
    ListIterator it = list.Iterator();
    while(it.hasNext()) System.out.println(it.next());

  public void run() {
    display("After Sort:");

Controller.java:37: cannot find symbol
symbol  : method Iterator()
location: interface java.util.List<CrewMember>
    ListIterator it = list.Iterator();
Controller.java:43: cannot find symbol
symbol  : method sort(java.util.List<CrewMember>)
location: class java.util.Collections
2 errors

Process completed.

In this one class Im getting these two errors. I think it may have something to do with how I started the array list but since I'm new to coding in java it could be anything that I've done. Does anyone know why I'm getting these errors and how i can fix it?

Edited by pritaeas: Fixed formatting

6 Years
Discussion Span
Last Post by Sseeth

1. Check your capitalisation! Java is case sensitive.
2. To make the sort meaningful your CrewMewmber class needs to implement Comparable, otherwize there's no way to know what the correct sort order for CrewMembers is.

Edited by JamesCherrill: n/a


What line? My capitalization looks correct in my code to me, and im not sure why, must have been due to JCreator and i forgot to fix it but the little error arrows should be under the periods on Collections.sort and list.iterator

Edited by Sseeth: n/a


Ok yeah it was the CrewMember class not implementing comparable. haha now i just have to figure out a way to do that. thanks.


The capitalisation was Iterator() vs iterator().
Comparable isn't too hard. For a quick start, you could just return the result of comparing the CrewMember's names (the String class implements Comparable already).


Yeah i just got it figured out. Thank you kindly, almost done now.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.