clankill3r, I am not sure I fully understood your need. You want to make statistics on frequency of letter pairs or triplets in a given text document
If you look for Markov Chain implementations, you will see they generate random text out of such statistics, so the text is almost looking natural. So there is an initial analysis phase doing what you want.
I believe it uses tree data structure to store the information, for efficient storage and retrieval. But necessarily simple if you don't know what are hash map or iterator. No offense meant here (we all start at zero), I just imply you should get familiar with the base concepts there.
To answer your question, an iterator is a mechanism allowing to "walk" a data structure, often called Collections in Java. These collections can be linear, like an ArrayList or a LinkedList, can Map objects on other objects, like HashMap, can be a Tree, etc.
In Java, an
Iterator is a blueprint for objects remembering where they are in a Collection, and how to get next object, if any.
So such object provides methods like hasNext() (is there any more element), and next() (provide next element).
You might also find
Enumeration with similar methods, but JavaDoc advise to use the moderner Iterator instead.