private char nextChar()
    {
        // dequeue
        if ( undo != null && undo.size() > 0 )
            return undo.remove(0);
        else if ( index == pairs.size() )
            return (char)-1;
        else
        {
            Pair p = pairs.get(index);
            char[] data = p.getChars();
            if ( offset < 0 )
                System.out.println("offset < 0" );
            char token = data[offset++];
            // prepare for next get
            if ( offset == data.length )
            {
                offset = -1;
                while ( index < pairs.size()-1 )
                {
                    p = pairs.get(++index);
                    if ( p.versions.nextSetBit(v)==v && p.length()>0 )
                    {
                        offset = 0;
                        break;
                    }
                }
                if ( offset == -1 )
                    token = (char)-1;
            }
            return token;
        }
    }