swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

List in java


From: david ROBIN
Subject: List in java
Date: Fri, 3 Dec 1999 05:55:06 -0800 (PST)

Hi, I am a french student user of swarm, and i got
problem using List in java under windows NT:

I don't know how to use the removefirst() method.

Once i filled the list with a certain kind of object(
for example a bugs list) I can't remove the first
object of that List using the removeFirst() method
because the return type of removeFirst is
java.lang.Object and not the same object type that i
use to fill the List(for example Bug).

sketch of code:

public List ListeAgent;
public Agent reporter;

 public Object buildObjects ()
{
...
for (i=0;i<nbPeople ;i++)
{
Agent anAgent =new Agent();
ListeAgent.addLast(anAgent);//so the List is fill with

                            //Agent objects
//set anAgent parameters
...
}
...
//i choose a reporter
reporter=ListeAgent.removeFirst();
...

}
I got the following compilation error:

***error the type of the left-hand side in this
assignment,"Agent",is not compatible with the type of
the right-hand side expression,"java/lang/Object"

this error is the only one i got.
thanks to anyone who could help me.
David

__________________________________________________
Do You Yahoo!?
Thousands of Stores.  Millions of Products.  All in one place.
Yahoo! Shopping: http://shopping.yahoo.com

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]