I want to add everything from ArrayList in class Taster in another ArrayList in class Tastatura. It's calling no suitable method error and I don't really know what to do and how to do it . I would be really thankfull if someone quickly explained me how this work and write my code correctly.
This is main class:
public class Tastatura {
public static void main(String[] args) {
Taster slovo = new Taster();
ArrayList<String> collection1 = new ArrayList<String>();
collection1.addAll(slovo); //<--- error here
}
}
another class:
public class Taster {
public Taster(){
ArrayList<String> Slova = new ArrayList<String>();
Slova.add("q");
Slova.add("w"); }}
Tasterisn't a collection of strings - so it doesn't make sense to callcollection1.addAll(slovo)... Do you at least understand the error?