Better way to write multiple if statements in java
<p>Hi so lately I've been doing a lot of java programming and I've been using a lot of if statements. the problem is i have to copy and paste the if statements over a hundred times to check all the senarios. Here is an example:</p>

<pre><code>while (i &lt; AreaNumbers.size()) {
        String roomnum = "j" + AreaNumbers.get(i);
        if (roomnum.equals("j100")) {
            if (k == 1) {
                j100.setVisible(true);
                j100.setToolTipText("&lt;html&gt;" + "&lt;br&gt;" + "Room Number: " + AreaNumbers.get(i) + "&lt;br&gt;" + "Incident ID: " + IncidentID.get(i) + "&lt;br&gt;" + " Teacher: " + Teachers.get(i) + "&lt;br&gt;" + " Description: " + Descriptions.get(i) + "&lt;/html&gt;");
                k = k + 1;
            } else if (k &gt; 0) {
                j100.setToolTipText(k + " help desk calls, click here for more information");
                k = k + 1;
            }
</code></pre>

<p>for this example i would copy and paste the <code>if (roomnum.equals("j100")) {</code> and everything past it for every label i want to check and compare. Is there anyway i could do this where i could write a statement that goes through this same scenario once and everywhere it sees <code>j100</code> it could replace it after each time with a different label, such as j101 j107 an so on. Im sorry if this isnt very clear i just cant think of a better way to word it. Thanks in advance.</p>
