Link to home
Start Free TrialLog in
Avatar of NorthReptile
NorthReptile

asked on

Problem with for each loop type

I have a class called OrderItem (see below) which I have added to an ArrayList.

When I try to do the for each code block it complains about incompatible types

private boolean analyseOrder(ArrayList orderList){

        for(OrderItem thisItem:orderList)

How do I get this to work?
public class OrderItem {
    public int orderNr;
    public String status;
    public int id;
    public String code;
    public String type;
    public String orderBitrix_codes;
    public int qtyPending;
    public int qtySent;
    public int ordered;
    public int inStock;
    public int minLevel;
    public int qtyWaiting;
    public int qtyCanceled;
    public long weight;
    public String shipCode;
    public long priceAll;
    public String shelf;
    public String holding;
    public String title;
    public String itemBitrix_codes;   
 
}

Open in new window

Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

It probably should be

private boolean analyseOrder(ArrayList orderList) {

What does

java -version

give you?
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NorthReptile
NorthReptile

ASKER

Yeah, that works. Thanks.

How would I declare that in my parameter so I can pass this version of the object?
>>How would I declare that in my parameter...

Not sure quite what you mean there but i think i covered it in my first comment
In my function I was passing this

private boolean analyseOrder(ArrayList orderList){

so when i do

ListorderList = new ArrayList();

analyseOrder(orderList);

Do i declare like this now?

private boolean analyseOrder(List orderList){
>>Do i declare like this now?

Yes