I want to distribute a certain number of items to an indefinite number of recipients, how do I code it?
I have this:
item = getitem.items();
LinkedList<String>[] distributedItems = new LinkedList<String>[item];
while (item !=0){
if (int c=0; c<r; c++){
recipientNum[].add(item.pollFirst());
else {
break;
}
}
return distributedItems;
}
where getitem.items is previously process method that I have to call which I assigned to item, r is the number of recipients, recipientNum was determined by this:
LinkedList<String>[] recipientNum = new LinkedList[r];
for (int z=0; z<r; z++){
recipientNum[z] = new LinkedList<String>();
System.out.println ("recipientNum[" + z + "]");
}
return recipientNum;
I have this error when trying to code:
while (card !=0){ --> Multiple markers at this line
- Syntax error on token "isEmpty", delete this token
- The method card() is undefined for the type Table
- Incompatible operand types LinkedList<String> and int
if (int c=0; c<p; c++){ --> Multiple markers at this line
- Syntax error on token "<", invalid Assignment Operator
- Syntax error on token ")", ; expected
- Syntax error on token(s), misplaced construct(s)
playerNum[].add(card.pollFirst()); --> Syntax error on token "[", Expression expected after this token
else { --> Syntax error on token "else", delete this token.
Why do I get these errors? Thank you in advance for your help guys ..