I have two arrayLists diferent types.....
ArrayList<Ergazomenos> erg=new ArrayList<Ergazomenos>();
ArrayList<Proistamenos> proist=new ArrayList<Proistamenos>();
I dont know how to copy ergazomenos to proistamenos. Can i use arraycopy?
what exactly do you mean with "copy" ?
ArrayList (Java Platform SE 6)
I want to copy all elements from arrayList erg to arrayList proist.
thanks for the answear
Does class Ergazomenos extend or implement Proistamenos?
If not then you can't (well, I suspect you could if you cheated, but you shouldn't).
class Proistamenos extends Ergazomenos
addAll() should work then.
I cant use addall because erg is type of Ergazomenos and proist is type of Proistamenos
thanks anyway for your answer
Yes you can.
Since Ergazomenos extends Proistamenos you can:
Because addAll() allows Collection<? extends E>...which would be Collection<? extends Proistamenos>. Which you just said Ergazomenos does.
ETA: Oops. I misread your post.
It's the other way around!
In which case you have a design flaw.
Um, you should start your own thread and not hijack someone else's.