I have a task to merge few lists in one. I need to get (i) element from each list and place it to (i) cell of 'books' list. It's hard for me because lists have different size. How can i do that? Here is some my code, but it doesnt work because of different sizes of lists:
 private LinkedList<String> books = new LinkedList<>();
    private LinkedList titles = new LinkedList();
    private LinkedList authors = new LinkedList<>();
    private LinkedList prices = new LinkedList<>();
    private LinkedList bestSellers = new LinkedList<>();
    public LinkedList createBooks() {
        for (int i = 0; i < 16; i++) {
            String temp, temp1, temp2, temp3;
             temp = (String) titles.get(i);
             temp1 = (String) authors.get(i);
             temp2 = (String) prices.get(i);
             temp3 = (String) bestSellers.get(i);
            books.addAll(i, Arrays.asList(temp, temp1, temp2, temp3));
        }
        return books;
    }
 
     
    