Java collection program – Code Review Stack Exchange


Could you review this program? Could you point what’s wrong etc.? I suppusoe something is wrong with display data from StringSplitter
Thank you in advance

Part 1
Write a program that puts 50 objects storing strings in the ArrayDeque queue, consisting of the letter ‘a’ repeated randomly (repeat range: 1-50).
Filling the object with the repeats of the letter ‘a’ should be done with a for loop.

Part 2

Extend the program from the first part in such a way that you pass the created queue to the method of your class, which will separate the objects from the queue into two ArrayList collections.
One of them will store objects with an even number of ‘a’ characters, the other one with an odd number.

 import java.util.*;
    import java.lang.*;
    import java.io.*;
    
    class StringSplitter {
    
        public String stringSplitter(Deque < String > theQuantity) {
    
    
            List < String > even = new ArrayList < > ();
            List < String > uneven = new ArrayList < > ();
    
            String word = null;
            while (theQuantity.size() > 0) {
                word = theQuantity.poll();
                if (word.length() % 2 == 0) {
                    even.add(word);
                    System.out.println("even word: " + word);
                } else {
                    uneven.add(word);
                    System.out.println("uneven word: " + word);
    
                }
            }
    
            return word;
        }
    }

class RandomGeneratorString {
    public static void main(String() args) throws java.lang.Exception {
        String sumA = "a";
        String a = "a";

        Deque < String > containerA = new ArrayDeque < > ();
        Random theGenerator = new Random();
        int numberA = 0;

        while (containerA.size() < 50) {
            numberA = theGenerator.nextInt(51);
            if (numberA != 0) {
                for (int i = 0; i <= numberA; i++)
                    sumA += a;
            }
            containerA.add(sumA);
        }

        StringSplitter wordA = new StringSplitter();
        wordA.stringSplitter(containerA);

    }
}