I want to know (with examples!) if there is a way to search through a list (not a file) and if it's found replace it
<p>I want to know (with examples!) if there is a way to search through a list (not a file) and if it's found replace it.</p>

<p>Background: Making a server but I want it to censor swear words and the system i have works it's just not efficient enough.</p>

<p>Current Code:</p>

<pre><code>     String impmessage = message.replaceAll("swearword1", "f***");
     String impmessage2 = impmessage.replaceAll("swearword2", "bi***");
     String impmessage3 = impmessage2.replaceAll("swearword3", "b***");
     String impmessage4 = impmessage3.replaceAll("swearword4", "w***");
     ...
     String impmessage8 = impmessage7.replace('%', '&amp;');
</code></pre>

<p>The whole shabang. But when I want to add a new word into the filter I have to add another one on there.</p>
