update attribute a element in arraylist on java?
<p>I have a class</p>

<pre><code>Class TextChunks extends Token {
    ArrayList&lt;Token&gt; arrt = new ArrayList&lt;Token&gt;();
}
</code></pre>

<p>extent fron class :</p>

<pre><code>class Token {
    String s;
    int frequency = 1 ;// Tern frequency in TextChunk
    }
</code></pre>

<p>Now in token i have arraylist token , i want to update attribute frequency of token in Texchunks when have more than one tokens same .</p>

<p>For clearly a give a example :</p>

<p>Texchunks :" in particular in domain and range in some  " </p>

<p>So have 8 token : in,particular,in,domain,and,range,in,some</p>

<p>i want update attribute frequency for token : in this example when i get attribute frequency of token "in" must return 3</p>

<p>it mean when i call : get frequency of Texchunks  when dislay :</p>

<pre><code>in 3
particular 1
in 3
domain 1 
and 1
range 1
in 3
some 1
</code></pre>

<p>here my code :</p>

<pre><code>public TextChunks updateFrequencyOfTokenInTextChunks (TextChunks tc) throws CloneNotSupportedException {
        TextChunks result = (TextChunks) tc.clone();

        for (int i =0 ; i&lt; result.arrt.size() ; i++ ){
            int j=i+1;
            if (result.arrt.get(i).compareTwoToken(result.arrt.get(j))== true )
            {
                // help here how to update attribute result.arrt.get(i) 
                            // and result.arrt.get(J) = ++ and 
            }

        }
        return tc;

    }
</code></pre>

<p>Thanks in advandce </p>

<p>Here is method compare two token</p>

<pre><code>    public boolean compareTwoToken(Token tk){
    if(this.s.toLowerCase().trim().equals(tk.s.toLowerCase()))
        return true;
    return false;
}
</code></pre>
