Zulfi Khan wrote:please guide me how to create a variable name for 'operation code and their count List.
A good name for an operation code:
operationCode. Or if it happens that "opcode" is the standard name for an operation code in this application and everybody says that, then
opCode would be satisfactory.
As for "count list"... I don't understand why you use that term, since all that code does is to produce a list which excludes some of the duplicates in the original list. There's no counting necessary, since the "add" method just adds an entry to the end of its list.
I also have to say that "tempStr" is a very strange name for something which comes out of an ArrayList<Object>. It's almost as if the entries in that list are actually String objects but for some reason the list was declared differently. Anyway I would call that variable
current and the variable which is supposed to hold the previous value, I'd call that
previous. There's no need to specify that they are Strings even if they are, the algorithm doesn't care and neither does the reader.