I have a array of string I will call a method on this array for each of the element of it ,the method will return one integer,but some of the elements are the same then I do not want to call the method .
for example this is the array:{aa ,bbc ,aa ,dddd};
and for example the method return the length of string
for(i = 0 ,i<array.size();i++){
method(array[i])}
I want if the element is repetitive then it wont call the method and just use the value we already have
what should I do in java ?