Is there anyway to assign name to ArrayList/Any Object using a String variable?
<p>I'm working on a problem I found from <code>exercism.io</code>. I creating a database for a school involving student with their respective information. I came up with a solution that could possibly work, but I'm not sure if it syntactically possible. </p>

<pre><code>import java.util.ArrayList;

class Student {
    String name;
    Integer grade;

    public Student(String name, Integer grade) {
        this.name = name;
        this.grade = grade;
    }
}
</code></pre>

<p>I want to keep track of grades created using a <code>ArrayList</code> that contains an <code>int</code> for each grade, without creating an entire k-12 realistic school setup. I want to add the grades as needed. So when adding a new student I'm checking if the gradeList contains the students grade, if not I create that grade. What I want to do is convert the student's grade to a <code>String</code>, and use that <code>String</code> as the name of the <code>ArrayList</code>.</p>

<p>Is this possible?</p>

<pre><code>public class School {
    Student current;
    ArrayList&lt;Integer&gt; gradeList;
    ArrayList&lt;ArrayList&lt;Student&gt;&gt; database;

    public School() {
        gradeList = new ArrayList&lt;Integer&gt;();
        database = new ArrayList&lt;ArrayList&lt;Student&gt;&gt;();
    }

    public void createGrade(Integer grade) {
        String addingGrade = Integer.toString(grade);
        ArrayList&lt;Student&gt; addingGrade
    }

    public void add(Student newS) {
        if (!gradeList.contains(newS.grade)) {
            createGrade(newS.grade);
        }

    }

}
</code></pre>